This repository has been archived on 2025-04-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
web/src/utils/MergeUint8Array.ts
鲁树人 1e7116a3a9 feat: add basic joox support
(cherry picked from commit 699333ca06526d747a7eb4a188e896de81e9f014)
2022-01-09 10:44:36 +08:00

16 lines
330 B
TypeScript

export function MergeUint8Array(array: Uint8Array[]): Uint8Array {
let length = 0;
array.forEach((item) => {
length += item.length;
});
let mergedArray = new Uint8Array(length);
let offset = 0;
array.forEach((item) => {
mergedArray.set(item, offset);
offset += item.length;
});
return mergedArray;
}