Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
variable 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.167.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 { toTransformStream } from "https://deno.land/std@0.167.0/streams/mod.ts";