import { toArrayBuffer } from "https://deno.land/std@0.220.0/streams/to_array_buffer.ts";
Converts a ReadableStream
of Uint8Array
s to an
ArrayBuffer
. Works the same asResponse.arrayBuffer
.
Examples
Example 1
Example 1
import { toArrayBuffer } from "https://deno.land/std@0.220.0/streams/to_array_buffer.ts";
const stream = ReadableStream.from([
new Uint8Array([1, 2]),
new Uint8Array([3, 4]),
]);
await toArrayBuffer(stream); // ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }
Parameters
readableStream: ReadableStream<Uint8Array>