Skip to main content
Go to Latest
function readableStreamFromReader

(will be removed after 1.0.0) Use toReadableStream instead.

import { readableStreamFromReader } from "";

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).

An example converting a Deno.FsFile into a readable stream:

import { readableStreamFromReader } from "";

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


reader: Reader | (Reader & Closer)
options: ReadableStreamFromReaderOptions = [UNSUPPORTED]