Spaces:
Paused
Paused
Download src/lib/utils/concatUint8Arrays.ts from vollsteksolutions/test: direct link, hf CLI and curl.
- Browser
- Download file 324 Bytes
-
https://huggingface.co/spaces/vollsteksolutions/test/resolve/main/src/lib/utils/concatUint8Arrays.ts
- Command line
-
hf download hf://spaces/vollsteksolutions/test/src/lib/utils/concatUint8Arrays.ts
-
curl -L -o concatUint8Arrays.ts https://huggingface.co/spaces/vollsteksolutions/test/resolve/main/src/lib/utils/concatUint8Arrays.ts
324 Bytes
| import { sum } from "./sum"; | |
| export function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array { | |
| const totalLength = sum(arrays.map((a) => a.length)); | |
| const result = new Uint8Array(totalLength); | |
| let offset = 0; | |
| for (const array of arrays) { | |
| result.set(array, offset); | |
| offset += array.length; | |
| } | |
| return result; | |
| } | |