{ "name": "end-of-stream", "version": "1.1.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", "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## Usage\n\nSimply pass a stream and a callback to the `eos`.\nBoth legacy streams and streams2 are supported.\n\n``` js\nvar eos = require('end-of-stream');\n\neos(readableStream, function(err) {\n\tif (err) return console.log('stream had an error or closed early');\n\tconsole.log('stream has ended');\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');\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');\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 ended but might still be writable');\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 readable');\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", "readmeFilename": "README.md", "_id": "end-of-stream@1.1.0", "_shasum": "e9353258baa9108965efc41cb0ef8ade2f3cfb07", "_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.1.0.tgz", "_from": "end-of-stream@>=1.1.0 <2.0.0" }