pumpcat

1.0.0 • Public • Published

pumpcat

pumpcat pipes streams together and concatenates strings or binary data and calls a callback with the result

pumpcat = pump + (concatination using bl)

npm install pumpcat

What problem does it solve?

All the problems that pump solves with added functionality of concatinating the buffer for you and let you handle the error.

Usage

Simply pass the streams you want to pipe together to pumpstream and add a callback

const pumpcat = require('pumpcat')
const { Readable, PassThrough } = require('stream')
 
const source = new Readable
const dest = new PassThrough()
 
pumpcat(source, dest, function(err, collection) {
  if (err) console.log('oops error occured', err)
  console.log('here is collection of data you wanted', collection)
})
 
setTimeout(function() {
  dest.destroy() // when dest is closed pumpcat will destroy source
}, 1000)

You can use pumpcat to pipe more than two streams together as well

var transform = someTransformStream()
 
pumpcat(source, transform, anotherTransform, dest, function(err, collection) {
  if (!err) console.log('got collection. YAY!')
})

If source, transform, anotherTransform or dest closes all of them will be destroyed.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1

Package Sidebar

Install

npm i pumpcat

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.16 kB

Total Files

5

Last publish

Collaborators

  • aks-