UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

30 lines 1.07 kB
import { ForkableSink } from './ForkableSink.js'; import { ControllableSource } from '../sources/ControllableSource.js'; import type { UnderlyingDefaultSource } from 'node:stream/web'; /** * An extension to the {@link ForkableSink:class} that immediately * queues the last received chunk to any fork. * * @group Sinks * @see {@link ForkableRecallStream:class} * @example * ``` * const forkable = new ForkableRecallSink<number>() * const writable = new WritableStream(forkable) * await fromCollection([1, 2, 3, 4, 5, 6, 7]).pipeTo(writable) * ``` * * Now the stream has finished, if we fork from it we'll * receive the last thing that was emitted. * * ``` * await forkable.fork().pipeTo(write(console.info)) * // 7 * ``` */ export declare class ForkableRecallSink<T> extends ForkableSink<T> { #private; write(chunk: T): void; protected _addController(underlyingSource?: UnderlyingDefaultSource<T>, queuingStrategy?: QueuingStrategy<T>): readonly [ControllableSource<T>, ReadableStream<T>]; } //# sourceMappingURL=ForkableRecallSink.d.ts.map