const a1 = new Uint8Array([1, 2, 3, 4, 5]);
const a2 = new Uint8Array([6, 7, 8, 9, 10, 20, 30]);
const arr = [a1, a2];
function merge(arr) {
const bytes = [];
const sizes = [];
const length = arr.length;
for (let a of arr) {
sizes.push(a.length);
for (let e of a) {
bytes.push(e);
}
}
return { bytes, sizes, length};
}
const result = merge([a1, a2]);
console.log(result);