Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/hex/src/lib/mod.ts>stdx.streams.readableStreamFromReader

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
variable stdx.streams.readableStreamFromReader
Deprecated
Deprecated

(will be removed after 0.169.0) Import from std/streams/readable_stream_from_reader.ts instead.

Create a ReadableStream<Uint8Array> from from a Deno.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 Deno.Closer).

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

import { readableStreamFromReader } from "https://deno.land/std@0.224.0/streams/mod.ts";

const file = await Deno.open("./file.txt", { read: true });
const fileStream = readableStreamFromReader(file);
import { stdx } from "https://deno.land/x/hex@0.6.5/src/lib/mod.ts";
const { readableStreamFromReader } = stdx.streams;