uint8ArrayToAsyncIterable
function uint8ArrayToAsyncIterable(data, chunkSize): AsyncIterable<Uint8Array<ArrayBufferLike>>;Defined in: packages/synapse-core/src/piece.ts:353
Convert Uint8Array to async iterable with optimal chunk size.
Uses 2048-byte chunks for better hasher performance (determined by manual testing with Node.js; this will likely vary by environment). This may not be optimal for the streaming upload case, so further tuning may be needed to find the best balance between hasher performance and upload chunk size.
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
data | Uint8Array | undefined | Uint8Array to convert |
chunkSize | number | 2048 | Size of chunks (default 2048) |
Returns
Section titled “Returns”AsyncIterable<Uint8Array<ArrayBufferLike>>
AsyncIterable yielding chunks