Functional transform helpers for Web Streams — map, filter, take, batch, and tap
npm install web-stream-transformimport {mapStream, filterStream, takeStream, batchStream, tapStream} from 'web-stream-transform';
const result = ReadableStream.from([1, 2, 3, 4, 5, 6])
.pipeThrough(filterStream(x => x % 2 === 0))
.pipeThrough(mapStream(x => x * 10))
.pipeThrough(takeStream(2));
// Yields: 20, 40Returns a TransformStream that applies function_ to each chunk.
Returns a TransformStream that only passes chunks where function_ returns true.
Returns a TransformStream that passes only the first count chunks then terminates.
Returns a TransformStream that collects chunks into arrays of size, flushing any remainder on close.
Returns a TransformStream that calls function_ for side effects but passes chunks through unchanged.
- node:stream/web - Node.js Web Streams API
MIT