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

x/capi/deps/std/streams.ts>readerFromStreamReader

[WIP] A framework for crafting interactions with Substrate chains
Latest
function readerFromStreamReader
import { readerFromStreamReader } from "https://deno.land/x/capi@v0.1.1-beta.1/deps/std/streams.ts";

Create a Reader from a ReadableStreamDefaultReader.

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>