Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/tests/deps/streams.ts>readerFromStreamReader

A better way to work with processes in Deno.
Go to Latest
function readerFromStreamReader
Deprecated
Deprecated

(will be removed after 1.0.0) Use ReadableStreamDefaultReader directly.

Create a Reader from a ReadableStreamDefaultReader.

import { readerFromStreamReader } from "https://deno.land/x/proc@0.21.8/tests/deps/streams.ts";

Examples

Example 1

import { copy } from "https://deno.land/std@0.224.0/streams/copy.ts";
import { readerFromStreamReader } from "https://deno.land/std@0.224.0/streams/reader_from_stream_reader.ts";

const res = await fetch("https://deno.land");
const file = await Deno.open("./deno.land.html", { create: true, write: true });

const reader = readerFromStreamReader(res.body!.getReader());
await copy(reader, file);
file.close();

Parameters

streamReader: ReadableStreamDefaultReader<Uint8Array>