Skip to main content

@std/streams@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function toArrayBuffer
toArrayBuffer(readableStream: ReadableStream<Uint8Array>): Promise<ArrayBuffer>

Converts a ReadableStream of Uint8Arrays to an ArrayBuffer. Works the same asResponse.arrayBuffer.

Examples

Example 1

import { toArrayBuffer } from "@std/streams/to_array_buffer";

const stream = ReadableStream.from([
  new Uint8Array([1, 2]),
  new Uint8Array([3, 4]),
]);
await toArrayBuffer(stream); // ArrayBuffer { [Uint8Contents]: <01 02 03 04>, byteLength: 4 }

Parameters

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/streams

Import symbol

import { toArrayBuffer } from "@std/streams/to_array_buffer";
or

Import directly with a jsr specifier

import { toArrayBuffer } from "jsr:@std/streams/to_array_buffer";