Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

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

An ecosystem delivering practices, philosophy and portability. Powered By Deno and JavaScript.
Latest
variable streams.toTransformStream
Deprecated
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.5/src/fw/generator/deps.ts";
const { toTransformStream } = streams;