Promise-based Node.js stream pipeline runner with progress tracking and controlled parallel transforms.
npm install pipeline-runner-streamsrunPipeline wrapper around stream/promises.
parallelTransform helper to process items with concurrency.
ts
import fs from 'fs';
import { runPipeline, parallelTransform } from 'stream-pipeline-runner';
await runPipeline({
source: fs.createReadStream('input.ndjson'),
transforms: [
parallelTransform(async (chunk) => {
// parse NDJSON line -> object
const obj = JSON.parse(chunk.toString());
// enrich or call API
return JSON.stringify(obj) + '\n';
}, { concurrency: 4 })
],
destination: fs.createWriteStream('out.ndjson'),
options: { timeoutMs: 30_000, onProgress: (p) => console.log(p) }
});
``