Spaces:
Runtime error
Runtime error
Download src/lib/utils/concatUint8Arrays.ts from kokofixcomputers/chat-ui: direct link, hf CLI and curl.
- Browser
- Download file 324 Bytes
-
https://huggingface.co/spaces/kokofixcomputers/chat-ui/resolve/main/src/lib/utils/concatUint8Arrays.ts
- Command line
-
hf download hf://spaces/kokofixcomputers/chat-ui/src/lib/utils/concatUint8Arrays.ts
-
curl -L -o concatUint8Arrays.ts https://huggingface.co/spaces/kokofixcomputers/chat-ui/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; | |
| } | |