{"_id":"pump-chain","_rev":"440103","name":"pump-chain","description":"A module that glues pump and bubble-stream-error to make things easier when your public API returns a stream.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"time":{"modified":"2021-08-05T06:31:57.000Z","created":"2015-11-27T08:30:01.381Z","1.0.0":"2015-11-27T08:30:01.381Z"},"users":{},"author":{"name":"Alexandru Vladutu"},"repository":{"type":"git","url":"git+https://github.com/alessioalex/pump-chain.git"},"versions":{"1.0.0":{"name":"pump-chain","description":"A module that glues pump and bubble-stream-error to make things easier when your public API returns a stream.","author":{"name":"Alexandru Vladutu"},"version":"1.0.0","main":"index.js","dependencies":{"bubble-stream-error":"^1.0.0","pump":"^1.0.1","sliced":"^1.0.1"},"devDependencies":{"alessioalex-standard":"*","husky":"0.10.x","proxyquire":"^1.7.3","tape":"4.2.x"},"scripts":{"lint":"alessioalex-standard","test":"tape test.js","precommit":"npm run lint && npm test"},"repository":{"type":"git","url":"git+https://github.com/alessioalex/pump-chain.git"},"bugs":{"url":"https://github.com/alessioalex/pump-chain/issues"},"homepage":"https://github.com/alessioalex/pump-chain#readme","license":"MIT","gitHead":"ba1bd51decb53c35440b622a1a26ee36fb5fc858","_id":"pump-chain@1.0.0","_shasum":"7d57d8d9ad8181ea808f5413c4f2bc1e786a5e37","_from":".","_npmVersion":"2.14.9","_nodeVersion":"4.2.1","_npmUser":{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"},"dist":{"shasum":"7d57d8d9ad8181ea808f5413c4f2bc1e786a5e37","size":2214,"noattachment":false,"key":"/pump-chain/-/pump-chain-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pump-chain/download/pump-chain-1.0.0.tgz"},"maintainers":[{"name":"alessioalex","email":"alexandru.vladutu@gmail.com"}],"directories":{},"publish_time":1448613001381,"_cnpm_publish_time":1448613001381,"_hasShrinkwrap":false}},"readme":"# pump-chain\n\nA module that glues [pump](http://npm.im/pump) and [bubble-stream-error](http://npm.im/bubble-stream-error) to make life easier when piping streams internally and returning an outer stream.\n\n[![build status](https://secure.travis-ci.org/alessioalex/pump-chain.png)](http://travis-ci.org/alessioalex/pump-chain)\n\n## what problem does it solve?\n\nConsider the situation when you are piping multiple streams internally and returning an outer stream.\nThat stream will be handled by users of your module so you need to make sure that the errors coming from the internal streams propagate to the outer one (which `bubble-stream-error` takes care of), otherwise they can't be caught and will blow up the process.\nAlso if one of the inner streams closes you want to make sure that the others get closed as well (which `pump` does).\n\n## usage\n\nSimply pass the streams you want to pipe together to `pump-chain`.\n\n```js\nvar pump = require('pump-chain');\nvar crypto = require('crypto');\nvar fs = require('fs');\nvar zlib = require('zlib');\n\nfunction getEncryptedCompressedWordsStream() {\n  var gzip = zlib.createGzip();\n  var password = new Buffer('car cat tree fireman');\n  var aes = crypto.createCipher('aes-256-cbc', password);\n\n  var rs = fs.createReadStream('/usr/share/dict/words');\n\n  // uncomment to simulate an error\n  /*\n  var i = 0;\n  rs.on('data', function() {\n    if (++i === 3) {\n      this.emit('error', new Error('3 is unlucky!'));\n    }\n  });\n  */\n\n  return pump(rs, aes, gzip);\n}\n\ngetEncryptedCompressedWordsStream().on('error', function handleError(err) {\n  console.error('\\n!!! something bad happened while streaming stuff !!!\\n');\n  throw err;\n}).pipe(process.stdout);\n```\n\n## tests\n\n```bash\nnpm test\n```\n\n## related\n\n[mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one\n\n## license\n\n[MIT](http://alessioalex.mit-license.org/)\n","_attachments":{},"homepage":"https://github.com/alessioalex/pump-chain#readme","bugs":{"url":"https://github.com/alessioalex/pump-chain/issues"},"license":"MIT"}