{"name":"end-of-stream","version":"1.0.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.3.0"},"scripts":{"test":"node test.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","_id":"end-of-stream@1.0.0","_shasum":"d4596e702734a93e40e9af864319eabd99ff2f0e","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"dist":{"shasum":"d4596e702734a93e40e9af864319eabd99ff2f0e","tarball":"http://registry-npm.ywwl.com/end-of-stream/download/end-of-stream-1.0.0.tgz","integrity":"sha512-oniaMOoG/dtbvWRLAlkFeJeJPM4IeE6BPFCHv0GTIIONB7A7kz1/liYWQiU7bqAhUlrKy1Z1MBsKa+qBgoVabw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCH1fh5cm5b9pODB1+91HR1MRkPjjjk1XPq54mMds8gcwIgCvIsXY0Wyt7psluGELRErFEn2ORYpIBx7hyWJz4Go/A="}],"size":1702,"noattachment":false,"key":"/end-of-stream/-/end-of-stream-1.0.0.tgz"},"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":1405940672385,"_cnpm_publish_time":1405940672385,"dist-tags":{"latest":"1.4.5"}}