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

x/hex/src/fw/generator/deps.ts>streams.readerFromIterable

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Go to Latest
variable streams.readerFromIterable
Deprecated
Deprecated

(will be removed after 0.169.0) Import from std/streams/reader_from_iterable.ts instead.

Create a Deno.Reader from an iterable of Uint8Arrays.

import { readerFromIterable, copy } from "https://deno.land/std@0.224.0/streams/conversion.ts";

const file = await Deno.open("metrics.txt", { write: true });
const reader = readerFromIterable((async function* () {
while (true) {
await new Promise((r) => setTimeout(r, 1000));
const message = `data: ${JSON.stringify(Deno.metrics())}\n\n`;
yield new TextEncoder().encode(message);
}
})());
await copy(reader, file);
import { streams } from "https://deno.land/x/hex@0.6.3/src/fw/generator/deps.ts";
const { readerFromIterable } = streams;