import { pipeThroughFrom } from "https://deno.land/x/streamtools@v1.0.0/pipe_through_from.ts";
Pipes the readable side of a TransformStream to a WritableStream. Returns the writable side of the TransformStream for further piping.
import { channel } from "./channel.ts";
import { collect } from "./collect.ts";
import { pipeThroughFrom } from "./pipe_through_from.ts";
const encoder = new TextEncoder();
const output = channel<string>();
const stream = pipeThroughFrom(output.writer, new TextDecoderStream());
const writer = stream.getWriter();
await writer.write(encoder.encode("Hello"));
await writer.write(encoder.encode("World"));
await writer.close();
writer.releaseLock();
const result = await collect(output.reader);
console.log(result); // ["Hello", "World"]