Nicer Node.js pipes.
Errors are not forwarded down the chain and you must handle them on each stream or they will be thrown from the main loop.
On possible work-around is to use a dedicated domain but:
- you should not handle continue after an error as been thrown;
- this API is not stable;
- it is a bit cumbersome to set up.
This can be a problem when you want to continue using a pipeline even if an error as occurred.
This is a common practice in build systems and gulp.js is also working on it on its side.
Not implemented yet.
Download manually or with package-manager.
Install globally if you want to use the CLI:
npm install --global nice-pipe
Install locally if you want to use it as a library:
npm install --save nice-pipe
const nicePipe = require("nice-pipe");
const parse = true;
const pipeline = nicePipe([
process.stdin,
// Falsy values are silently ignored.
parse && require("csv2json")(),
process.stdout,
]);
pipeline.on("error", function (error) {
console.error(error);
});
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.
ISC © Julien Fontanet