API reference › @evolu/common › Bytes › concatBytes

const concatBytes: typeof nobleConcatBytes = nobleConcatBytes;

Defined in: packages/common/src/Bytes.ts:161

Copies several Uint8Arrays into one.

Each array is a separate argument, so it is meant for a few arrays. Spreading many arrays into it overflows the call stack; use concatByteArrays when their count is not bounded.

Example

import { assertEqual, concatBytes } from "@evolu/common";

assertEqual(
  concatBytes(new Uint8Array([1]), new Uint8Array([2, 3])),
  new Uint8Array([1, 2, 3]),
);