Skip to main content
Module

x/faster/deps.ts>readableStreamFromReader

A fast and optimized middleware server with an absurdly small amount of code (300 lines) built on top of Deno's native HTTP APIs with no dependencies. It also has a collection of useful middlewares: log file, serve static, CORS, session, rate limit, token, body parsers, redirect, proxy and handle upload. In "README" there are examples of all the resources. Faster's ideology is: all you need is an optimized middleware manager, all other functionality is middleware.
Go to Latest
function readableStreamFromReader
Deprecated
Deprecated

(will be removed after 1.0.0) Use ReadableStream directly.

Create a ReadableStream<Uint8Array> 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 "https://deno.land/std@0.224.0/streams/readable_stream_from_reader.ts";

const file = await Deno.open("./file.txt", { read: true });
const fileStream = readableStreamFromReader(file);
import { readableStreamFromReader } from "https://deno.land/x/faster@v8.0/deps.ts";

Parameters

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