Build object-stream pipelines from plain functions, generators, Node streams, or Web streams with automatic backpressure. Version 4.2.3, released March 2025, requires Node >=22. Unlike 'pump' or 'pipeline', every stage can be a sync/async function, generator, or stream — no boilerplate. Ships TypeScript types, zero dependencies, and runs on Node, Bun, and Deno. Includes built-in JSONL parsing/writing. Actively maintained with weekly releases.
npm install stream-chainNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a JSONL processing pipeline: parse, filter inactive records, enrich asynchronously, stringify, and write to file with backpressure.
Use import, or downgrade to stream-chain@3.x (CJS).
Ensure all functions in the chain return a value or explicitly return chain.none to drop a record. Do not return undefined.
Replace import 'stream-chain/jsonl/read.js' with 'stream-chain/jsonl/file/parser.js'.
Use async generators (function* or async function*) for stages that emit multiple values per input; chain.many() buffers all values in memory.
Upgrade to 4.3.0+ or wrap generator body in try-catch and emit errors via the stream's 'error' event.
The /web subpath exports a different API (Web Streams). Use import chain from 'stream-chain' for Node streams, or import { chain } from 'stream-chain/web'.Pass an array of stages to chain(): const pipeline = chain([stage1, stage2]);
Use pipeline() from 'stream/promises' to properly manage backpressure and cleanup: await pipeline(source, chain(...), dest);
chain.none is a symbol, not a function. Return it directly: return chain.none;
Convert to ES modules (set type: module in package.json) and use import, or downgrade to stream-chain@3.
No dependency data recorded yet.