Function toReadableStream

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

    Parameters

    Returns ReadableStream<Uint8Array>

    The readable stream

    import { toReadableStream } from "@std/io/to-readable-stream";

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