nice-pipedeprecated

Nicer Node.js pipes

Usage no npm install needed!

<script type="module">
  import nicePipe from 'https://cdn.skypack.dev/nice-pipe';
</script>

README

nice-pipe

Build Status Dependency Status devDependency Status

Nicer Node.js pipes.

Issues with Node pipes

Errors are not forwarded

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.

Streams unpipe on error

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.

Install

Download manually or with package-manager.

npm

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

Usage

var nicePipe = require('nice-pipe')

var parse = true

var pipeline = nicePipe([
  process.stdin,

  // Falsy values are silently ignored.
  parse && require('csv2json')(),

  process.stdout
]);


pipeline.on('error', function (error) {
  console.error(error)
})

Contributions

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.

License

ISC © Julien Fontanet