Module

x/proc/legacy/deps.ts>toReadableStream

A better way to work with processes in Deno.
Very Popular
Latest
function toReadableStream
import { toReadableStream } from "https://dotland.deno.dev/x/proc@0.21.9/legacy/deps.ts";

Create a {@link ReadableStream} of {@link Uint8Array}s 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 "https://deno.land/std@$STD_VERSION/io/to_readable_stream.ts";

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

Parameters

reader: Reader | (Reader & Closer)
optional
unnamed 1: ToReadableStreamOptions = [UNSUPPORTED]

Returns

ReadableStream<Uint8Array>