UNPKG

uint8arrays

Version:

Utility functions to make dealing with Uint8Arrays easier

12 lines 293 B
export function concat(arrays, length) { if (!length) { length = arrays.reduce((acc, curr) => acc + curr.length, 0); } const output = new Uint8Array(length); let offset = 0; for (const arr of arrays) { output.set(arr, offset); offset += arr.length; } return output; }