Deprecated
(will be removed after 0.169.0) Import from std/streams/to_transform_stream.ts
instead.
Convert the generator function into a TransformStream.
import { readableStreamFromIterable, toTransformStream } from "https://deno.land/std@0.224.0/streams/conversion.ts";
const readable = readableStreamFromIterable([0, 1, 2])
.pipeThrough(toTransformStream(async function* (src) {
for await (const chunk of src) {
yield chunk * 100;
}
}));
for await (const chunk of readable) {
console.log(chunk);
}
// output: 0, 100, 200
import { streams } from "https://deno.land/x/hex@0.6.3/src/fw/generator/deps.ts";
const { toTransformStream } = streams;