{"name":"end-of-stream","version":"0.1.2","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","_id":"end-of-stream@0.1.2","dist":{"shasum":"5079910317c36b7870f655d4c7c1fb614daddaa5","tarball":"http://registry-npm.ywwl.com/end-of-stream/download/end-of-stream-0.1.2.tgz","integrity":"sha512-e3toIW28ngrEv8A2gQulh/y7sexoAbNNqfasx473/l+IYPBEoJVV/ZIb3dVrM70Un+fwnQI2tu9K+CF8VDSW6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFTeQkZugf982g42bkIyWAFBDrMdx3uypt5wBXVjnUpQIhAMD1adc/3wVlhlGLSFJZ0sw+h7adzAOSWQSBaIsRpuIP"}],"size":1452,"noattachment":false,"key":"/end-of-stream/-/end-of-stream-0.1.2.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"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":1385514960613,"_cnpm_publish_time":1385514960613,"dist-tags":{"latest":"1.4.5"}}