import { readerFromStreamReader } from "https://deno.land/std@0.222.1/io/mod.ts";
Create a Reader
from a ReadableStreamDefaultReader
.
Examples
Example 1
Example 1
import { copy } from "https://deno.land/std@0.222.1/io/copy.ts";
import { readerFromStreamReader } from "https://deno.land/std@0.222.1/io/reader_from_stream_reader.ts";
const res = await fetch("https://deno.land");
using file = await Deno.open("./deno.land.html", { create: true, write: true });
const reader = readerFromStreamReader(res.body!.getReader());
await copy(reader, file);
Parameters
streamReader: ReadableStreamDefaultReader<Uint8Array>