method StreamClass.prototype.into
Private
StreamClass.prototype.into(sink: WritableStream<T>): StreamClass<T, E>

Tees every value into a web WritableStream while passing all elements through — Elixir's Stream.into/2, with the platform's own sink as the Collectable. The sink is closed on normal completion and released on early exit; failures pass the tee but are not written (the sink types T, not T | E).

const written: number[] = [];
const sink = new WritableStream<number>({ write: (n) => void written.push(n) });
await Stream.from([1, 2, 3]).into(sink).collect(); // [1, 2, 3]
written; // [1, 2, 3]

Parameters

Return Type

Usage

import { StreamClass } from "lib/stream/stream.ts";