Skip to main content

@std/io@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 toReadableStream
toReadableStream(
reader: Reader | (Reader & Closer),
): ReadableStream<Uint8Array>

Create a ReadableStream of Uint8Arrays from a Reader.

When the pull algorithm is called on the stream, a chunk from the reader will be read. When null is returned from the reader, the stream will be closed along with the reader (if it is also a Closer).

Examples

Example 1

import { toReadableStream } from "@std/io/to_readable_stream";

const file = await Deno.open("./file.txt", { read: true });
const fileStream = toReadableStream(file);

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/io

Import symbol

import { toReadableStream } from "@std/io";
or

Import directly with a jsr specifier

import { toReadableStream } from "jsr:@std/io";