Converts a ReadableStream of Uint8Array chunks to a single Uint8Array.
Reads and concatenates all chunks from the stream into a single buffer. Useful for loading binary data from streams.
Optional
The ReadableStream to convert (returns empty Uint8Array if null/undefined)
Promise resolving to the concatenated Uint8Array
const response = await fetch('/image.png');const bytes = await stream2uint8array(response.body); Copy
const response = await fetch('/image.png');const bytes = await stream2uint8array(response.body);
Converts a ReadableStream of Uint8Array chunks to a single Uint8Array.
Reads and concatenates all chunks from the stream into a single buffer. Useful for loading binary data from streams.