UNPKG

uint8arrays

Version:

Utility functions to make dealing with Uint8Arrays easier

19 lines (15 loc) 392 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); 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; } exports.concat = concat;