concat

import { concat } from "jsr:@ende/bytes";

function

function concat(buffers: readonly Uint8Array[]): Uint8Array_

Concatenate an array of byte slices into a single slice.

buffers: readonly Uint8Array[]

Array of byte slices to concatenate.

Returns

A new byte slice containing all the input slices concatenated.

Example: Basic usage

import { concat } from "@ende/bytes/concat";
import { assertEquals } from "@ende/assert";

const a = new Uint8Array([0, 1, 2]);
const b = new Uint8Array([3, 4, 5]);

assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5]));

Source