API reference › @evolu/common › Bytes › concatByteArrays

function concatByteArrays(
  arrays: readonly Uint8Array<ArrayBufferLike>[],
): Uint8Array;

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

Copies an array of Uint8Arrays into one.

Unlike concatBytes, it takes the arrays as one array, so it works for any number of them, such as the timestamps of a batch received from a peer.

Example

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

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