{"name":"end-of-stream","version":"1.4.0","description":"Call a callback when a readable/writable/duplex stream has completed or failed.","repository":{"type":"git","url":"git://github.com/mafintosh/end-of-stream.git"},"dependencies":{"once":"^1.4.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["stream","streams","callback","finish","close","end","wait"],"bugs":{"url":"https://github.com/mafintosh/end-of-stream/issues"},"homepage":"https://github.com/mafintosh/end-of-stream","main":"index.js","author":{"name":"Mathias Buus","email":"mathiasbuus@gmail.com"},"license":"MIT","gitHead":"0ae1658b8167596fafbb9195363ada3bc5a3eaf2","_id":"end-of-stream@1.4.0","_shasum":"7a90d833efda6cfa6eac0f4949dbb0fad3a63206","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"7a90d833efda6cfa6eac0f4949dbb0fad3a63206","tarball":"http://registry-npm.ywwl.com/end-of-stream/download/end-of-stream-1.4.0.tgz","integrity":"sha512-NOyFg46+wLQq7Rmn+5cgC74jwx5L0beaaabXs2qMNbGM2gl2w27jwWEyN94CU/YRndlua/PZJ5MYz1cjP4y3VQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDl3Z4st75FxnRB3+RoRI5o73RdjUaN5WqaOERb+pBZFgIhAND0D1mxDFI84XXwypKIHKhs+8Sn6Wf6RdnX9eElg3lP"}],"size":2263,"noattachment":false,"key":"/end-of-stream/-/end-of-stream-1.4.0.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/end-of-stream-1.4.0.tgz_1489488042174_0.6194448405876756"},"directories":{},"readme":"# end-of-stream\n\nA node module that calls a callback when a readable/writable/duplex stream has completed or failed.\n\n\tnpm install end-of-stream\n\n[![Build status](https://travis-ci.org/mafintosh/end-of-stream.svg?branch=master)](https://travis-ci.org/mafintosh/end-of-stream)\n\n## Usage\n\nSimply pass a stream and a callback to the `eos`.\nBoth legacy streams, streams2 and stream3 are supported.\n\n``` js\nvar eos = require('end-of-stream');\n\neos(readableStream, function(err) {\n  // this will be set to the stream instance\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has ended', this === readableStream);\n});\n\neos(writableStream, function(err) {\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has finished', this === writableStream);\n});\n\neos(duplexStream, function(err) {\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has ended and finished', this === duplexStream);\n});\n\neos(duplexStream, {readable:false}, function(err) {\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has finished but might still be readable');\n});\n\neos(duplexStream, {writable:false}, function(err) {\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has ended but might still be writable');\n});\n\neos(readableStream, {error:false}, function(err) {\n\t// do not treat emit('error', err) as a end-of-stream\n});\n```\n\n## License\n\nMIT\n\n## Related\n\n`end-of-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.\n","publish_time":1489488044044,"_cnpm_publish_time":1489488044044,"dist-tags":{"latest":"1.4.5"}}