{"_id":"promisepipe","_rev":"18-0f9a21ce292fdbfb37f22276af5752e9","name":"promisepipe","description":"Pipe node.js streams safely with Promises","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"promisepipe","version":"1.0.0","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/epeli/node-promisepipe"},"keywords":["promise","q","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"mocha":"~1.13.0"},"_id":"promisepipe@1.0.0","dist":{"shasum":"f8ad789cf4ce9c77e8ce045e44d68e3f597123f1","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-1.0.0.tgz","integrity":"sha512-NLA/fJtDFdPTMeRVpQFk+e1tGz8kJ9rGZr01Lml/HOcVVSS3Uol52fJjCm43NJYo9TaujPM14pQjt2KlknFvhw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEgQ3F3QsMOY8BPdSEQDCHSuW9UfU4LGj0NxddJXb+h/AiEA/7fpvwrKoINFvrsIAYNwpT9CRu+jqTYguA2iIUmEId4="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"epeli","email":"esa-matti@suuronen.org"},"maintainers":[{"name":"epeli","email":"esa-matti@suuronen.org"}],"directories":{}},"1.0.1":{"name":"promisepipe","version":"1.0.1","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"https://github.com/epeli/node-promisepipe"},"keywords":["promise","q","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"mocha":"~1.13.0"},"_id":"promisepipe@1.0.1","dist":{"shasum":"7c5ccaecb399d9e3be8553fb91251c0a24e65921","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-1.0.1.tgz","integrity":"sha512-PlpqBdU2cP1BaNYZ9q3iqbMwVUcxvQvRuOJVS2VNGDIqJA6zqf0p603/X+5Or/maeIorl4ifuNPv9mck0qUkyQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAwv68n4ReDW35Me8dSp4RqA9TrxlDkiHpVqAL4G/IQTAiAl/b/DElYl5ftSpWkHzwB6tTjDbsR5IR/jgPkE6PXaQQ=="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"epeli","email":"esa-matti@suuronen.org"},"maintainers":[{"name":"epeli","email":"esa-matti@suuronen.org"}],"directories":{}},"2.0.0":{"name":"promisepipe","version":"2.0.0","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","q","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"970336c8deb9f8486086fb93c67ba8960c9f19be","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@2.0.0","_shasum":"57715b7ce4e35652b81c7d9d53727c367f35209d","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.2.1","_npmUser":{"name":"epeli","email":"esa-matti@suuronen.org"},"dist":{"shasum":"57715b7ce4e35652b81c7d9d53727c367f35209d","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-2.0.0.tgz","integrity":"sha512-WjSPgD94poOtEGAkWKjoKiIk3ewJAURsEDKTf1GieTaPKQjBcXdDo/IM/dGGdDdNC9CgAREmkfK0Qf9qCx32Pg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGQP4i1V678dl3FstklLD8zE7W1VuF7bb+pxAan62z3BAiAo773MWjYDxObQB1CbAw8OG2xoe4WVu0LKS8cyejttwg=="}]},"maintainers":[{"name":"epeli","email":"esa-matti@suuronen.org"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/promisepipe-2.0.0.tgz_1484144896652_0.08792887139134109"},"directories":{}},"2.1.0":{"name":"promisepipe","version":"2.1.0","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"417b6f8393eb48aad611892ead327e59fcff45f5","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@2.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.0","_npmUser":{"name":"epeli","email":"esa-matti@suuronen.org"},"dist":{"integrity":"sha512-5oRCkyvmPJ78lhdd4YOKNdz2hOu+yrVVilZEO8YBrRcBk6MWsW4ws7LryAeRmKkL7Z87kaJWZIopG2nErluJQA==","shasum":"5e6d4109957d6ff6bfcac555bbb50f7713594c53","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-2.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGkg5s5mBnR+oZ66QJakaDX7N6Hri6UGxu1/J2fsUkgaAiEAvevrG/N0yNbZX28759l26u4beQIobc1VcRps2VlYKiU="}]},"maintainers":[{"name":"epeli","email":"esa-matti@suuronen.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisepipe-2.1.0.tgz_1509695954084_0.020745911868289113"},"directories":{}},"2.1.1":{"name":"promisepipe","version":"2.1.1","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"2c11345943dc5f628906491de0e26b3c880a7961","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@2.1.1","_shasum":"c3046d608ad34dd635cc7ffd7e6d16ff7ac3cc83","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.5","_npmUser":{"name":"epeli","email":"esa-matti@suuronen.org"},"dist":{"shasum":"c3046d608ad34dd635cc7ffd7e6d16ff7ac3cc83","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-2.1.1.tgz","integrity":"sha512-S+msS1NfvjufZwqJHWck9XlBUajV2E7ZvhEbElOXKclVxOHF7RBq/p2Z+eaNay7QJF5L8SJAzXzNtd8/amebnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFgMVshsO5bVcnYMMo9YM1S3Dz+gQ8G/TnRm/HvjmRZ5AiAMQpBZOCb6G4DWKzF+pq51l+zjFn1xbei65MI5p6i58g=="}]},"maintainers":[{"name":"epeli","email":"esa-matti@suuronen.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisepipe-2.1.1.tgz_1509696350755_0.44982519606128335"},"directories":{}},"2.1.2":{"name":"promisepipe","version":"2.1.2","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"e6ceef3fe68a659c523d775b7b48c8f7819ad311","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@2.1.2","_npmVersion":"5.4.2","_nodeVersion":"8.8.1","_npmUser":{"name":"martin-kolarik","email":"martin@kolarik.sk"},"dist":{"integrity":"sha512-XBa14UrXiH9ThyQN/Ok3tUv9ilw6eXpK3OM2oa3vnzCUeD9vERBJAKKZKMg5l6g4lW0xRe3wmroYQTLl228kfg==","shasum":"356bf7ea35793b1e24714f57ad592f70da18b1a5","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-2.1.2.tgz","fileCount":9,"unpackedSize":10999,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0IP9wpkD5rhgaEWHMSIyG+xJ5SIb6rigxaKt18/3j+QIgdgechUCipsRptISgzz9cKmogEBV06KAO+vNlxpqHx1k="}]},"maintainers":[{"email":"esa-matti@suuronen.org","name":"epeli"},{"email":"martin@kolarik.sk","name":"martin-kolarik"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisepipe_2.1.2_1520547662297_0.9542226429194289"},"_hasShrinkwrap":false},"2.1.3":{"name":"promisepipe","version":"2.1.3","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"337c468841c70b7b1924ff76ff643700e03e7a10","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@2.1.3","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"martin-kolarik","email":"martin@kolarik.sk"},"dist":{"integrity":"sha512-pPJRbWEGIuPrjWAdN2lZLRuv+5wMNyig0dniGbMfadS7EK+/kxKqkjAA02iZI+S5Om0tCu6MC1JrjWYs8BlheQ==","shasum":"af22d90c6c1be3735d64b26c285dedb0d16fc99a","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-2.1.3.tgz","fileCount":9,"unpackedSize":11081,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBeqAZLe8MLKsL8sp8RXU/HRz/3MtJ1hMZV44sIhCsw7AiBy+VNussSKuv11gKl5RIyVIouPpbBdMFD9G+aOFcOTCQ=="}]},"maintainers":[{"email":"esa-matti@suuronen.org","name":"epeli"},{"email":"martin@kolarik.sk","name":"martin-kolarik"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisepipe_2.1.3_1523139812420_0.17730956916931384"},"_hasShrinkwrap":false},"3.0.0":{"name":"promisepipe","version":"3.0.0","description":"Pipe node.js streams safely with Promises","main":"index.js","scripts":{"test":"mocha test.js"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"keywords":["promise","stream"],"author":{"name":"Esa-Matti Suuronen"},"license":"MIT","bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"devDependencies":{"mocha":"^3.2.0","mz":"^2.6.0"},"dependencies":{},"gitHead":"abcbeb5ae2391dbde2446d7c1d4577765b247c54","homepage":"https://github.com/epeli/node-promisepipe#readme","_id":"promisepipe@3.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.8.0","_npmUser":{"name":"martin-kolarik","email":"martin@kolarik.sk"},"dist":{"integrity":"sha512-V6TbZDJ/ZswevgkDNpGt/YqNCiZP9ASfgU+p83uJE6NrGtvSGoOcHLiDCqkMs2+yg7F5qHdLV8d0aS8O26G/KA==","shasum":"c9b6e5aa861ef5fcce6134f6f75e14f8f30bd3b2","tarball":"https://registry.npmjs.org/promisepipe/-/promisepipe-3.0.0.tgz","fileCount":9,"unpackedSize":13064,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbZdPrCRA9TVsSAnZWagAA0lwP/jNZrH1pLAignTbsl4Xt\nTvjelGfdmMjQ/d3nWGQdn66DGKhbBQ1kqx3L99ZJXaekCo+2JvSvJsviO6F5\nGnLgKPZJHafnIfHW5UYMWT2kAKjsIR/JVKxh+LbTgfDevLbkTCv2BHg/9rpQ\nhRMdM1dmPRGlfeNEOMy+dFbJx+gnhgQwZ6Vq14j6w+Orwm8yy7vwtlD9hAwR\nN7FQZZ+mnMepXi2KUUHW0RkOSXWLKqKvVEeoBIGKJJYRWdrbxyTxjT4AuSFz\nQ7hidOGhP1+llmm2ULBZ7LXEULYavvi+McZxNsVzUQdV7s7CPDc1aDgZpt1l\nzxshxDdWia/usbEDrg/7HEw0evx28n6Fk9LgUQWd5Fqo9uPLVrJEjqHgsxMg\nhAGmP6Dy6/rzDJ+6LUb9TdVa2agAj6CHCYkYfU4RfRQDy4uENEkEmkPI2yFO\n50czp+1UBwHIYolYa4vUvzQawXxuo+1IZErWarglZEyaS5MC4lqmBwBBVSuW\nyF4PiiBc6jGk9AY3wm4Yp75kZLqx42RDsZeL8Dmb13T82JeEN2bVb1a8bbxu\n1h5t2W3RSg3+SmJt3SS4kfUH0vvMt4wJog8X/1GW2EH0J5cunvpIS/mVL0WF\n/fnuUNZELnes+GPMbtB5twu9FMvIFy3b/is5hL6widsi+KxyphK9ouLAbnqS\n2fqc\r\n=Jpwx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGpXHvVviQ7Xjyc/1J7zQCaD7PTQjtAa5ZOc66PM2T9EAiAukgsg2ovketbf0n2LxrfsLAHLb5EemakStwQ/ayxS7w=="}]},"maintainers":[{"email":"esa-matti@suuronen.org","name":"esamatti"},{"email":"martin@kolarik.sk","name":"martin-kolarik"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/promisepipe_3.0.0_1533400042742_0.0505576649654631"},"_hasShrinkwrap":false}},"readme":"# promisePipe\n\nSafely pipe node.js streams while capturing all errors to a single promise.\n\n## Install\n\n    npm install promisepipe\n\n## API\n\n```\npromisePipe(<readable stream>, [transform streams...], <writeable stream>)\n```\n\nIt returns a native promise. On success the resolved value will be an array of the\nstreams passed in. When rejected an error object is created with following\nkeys:\n\n  - `source`: The stream that caused the error\n  - `originalError`: Original error from the stream\n  - `message`: The error message from original error\n  \nNote: the last stream in the chain needs to be a writable stream, not a duplex/transform stream. If you use a 3rd party library which returns deplux streams instead of writable streams, you'll need to add something like [`.pipe(devnull())`](https://www.npmjs.com/package/dev-null) to the end, otherwise the promise will never resolve ([#16](https://github.com/epeli/node-promisepipe/issues/16)).\n\nStarting with v3, all streams are destroyed if there's an error to prevent memory leaks.\n\n## Example\n\n```javascript\nvar promisePipe = require(\"promisepipe\");\n\npromisePipe(\n    fs.createReadStream(INPUT_FILE),\n    new UpcaseTransform(),\n    fs.createWriteStream(OUTPUT_FILE),\n).then(function(streams){\n    console.log(\"Done writing to the output file stream!\");\n}, function(err) {\n    console.log(\"This stream failed:\", err.source);\n    console.log(\"Original error was:\", err.originalError);\n});\n```\n\nor with async-wait\n\n```javascript\nvar promisePipe = require(\"promisepipe\");\n\n(async () => {\n  try {\n    await promisePipe(\n      fs.createReadStream(INPUT_FILE),\n      new UpcaseTransform(),\n      fs.createWriteStream(OUTPUT_FILE)\n    );\n    console.log(\"Done writing to the output file stream!\");\n  } catch (err) {\n    console.log(\"This stream failed:\", err.source);\n    console.log(\"Original error was:\", err.originalError);\n  }\n})();\n\n```\n\n## Why?\n\nStream piping in node.js is cool, but error handling is not because streams\ndo not bubble errors to the target streams.\n\nFor example if the previous example is written like this:\n\n```javascript\nfs.createReadStream(INPUT_FILE)\n  .pipe(new UpcaseTransform())\n  .pipe(fs.createReadStream(OUTPUT_FILE))\n```\n\nIt might crash your program at any time. You must handle the errors\nfrom each stream manually like this:\n\n```javascript\nfs.createReadStream(INPUT_FILE).on(\"error\", function(err) {\n    // handle the error\n}).pipe(new UpcaseTransform()).on(\"error\", function(err) {\n    // handle the error\n}).pipe(fs.createReadStream(OUTPUT_FILE)).on(\"error\", function(err) {\n    // handle the error\n})\n```\n\nHandling errors this way can be very cumbersome. `promisepipe` simplifies\nerror handling by sending the first error occurance into a promise.\n","maintainers":[{"email":"esa-matti@suuronen.org","name":"esamatti"},{"email":"martin@kolarik.sk","name":"martin-kolarik"}],"time":{"modified":"2022-06-24T19:35:08.689Z","created":"2013-10-15T18:20:07.777Z","1.0.0":"2013-10-15T18:20:11.761Z","1.0.1":"2013-10-15T19:26:21.108Z","2.0.0":"2017-01-11T14:28:17.431Z","2.1.0":"2017-11-03T07:59:15.181Z","2.1.1":"2017-11-03T08:05:50.868Z","2.1.2":"2018-03-08T22:21:02.359Z","2.1.3":"2018-04-07T22:23:32.492Z","3.0.0":"2018-08-04T16:27:22.809Z"},"author":{"name":"Esa-Matti Suuronen"},"repository":{"type":"git","url":"git+https://github.com/epeli/node-promisepipe.git"},"users":{"greendwin":true,"tzq1011":true},"homepage":"https://github.com/epeli/node-promisepipe#readme","keywords":["promise","stream"],"bugs":{"url":"https://github.com/epeli/node-promisepipe/issues"},"license":"MIT","readmeFilename":"README.md"}