UNPKG

sflow

Version:

sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil

12 lines (11 loc) 396 B
type COMOPSER<T, R> = TransformStream<T, R> & { by: <Z>(stream: TransformStream<R, Z>) => COMOPSER<T, Z>; }; export function composers<T, R>(stream: TransformStream<T, R>): COMOPSER<T, R> { return Object.assign(stream, { by: <Z>(appendStream: TransformStream<R, Z>) => composers({ writable: stream.writable, readable: stream.readable.pipeThrough(appendStream), }) }); }