{ "name": "read-all-stream", "version": "3.0.1", "description": "Read all stream content and pass it to callback", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/floatdrop/read-all-stream.git" }, "author": { "name": "Vsevolod Strukchinsky", "email": "floatdrop@gmail.com" }, "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "files": [ "index.js" ], "keywords": [ "stream", "read", "buffer", "callback" ], "devDependencies": { "mocha": "*" }, "dependencies": { "pinkie-promise": "^1.0.0", "readable-stream": "^2.0.0" }, "readme": "# read-all-stream [![Build Status][travis-image]][travis-url]\n\n> Read stream to buffer or string\n\n## Install\n\n```sh\n$ npm install --save read-all-stream\n```\n\n## Usage\n\n```js\nvar read = require('read-all-stream');\nvar stream = fs.createReadStream('index.js');\n\nread(stream).then(function (data) {\n\tconsole.log(data.length);\n});\n\nread(stream, 'utf8', function (err, data) {\n\tconsole.log(data.length);\n\t//=> 42\n});\n\n```\n\n### API\n\n#### read(stream, [options], [callback])\n\nIf callback is omitted, Promise will be returned.\n\n##### stream\n\n*Required* \nType: `Stream`\n\nEvent emitter, which `data` events will be consumed.\n\n##### options\n\nType: `object` or `string`\n\nIf type of `options` is `string`, then it will be used as encoding.\nIf type is `Object`, then next options are available:\n\n##### options.encoding\n\nType: `string`, `null` \nDefault: `'utf8'`\n\nEncoding to be used on `toString` of the data. If null, the body is returned as a Buffer.\n\n##### callback(err, data)\n\nWill be called after stream is read.\n\n###### err\n\n`Error` object (if `error` event happens).\n\n###### data\n\nThe data in stream.\n\n## License\n\nMIT © [Vsevolod Strukchinsky](floatdrop@gmail.com)\n\n[travis-url]: https://travis-ci.org/floatdrop/read-all-stream\n[travis-image]: http://img.shields.io/travis/floatdrop/read-all-stream.svg?style=flat\n", "readmeFilename": "readme.md", "bugs": { "url": "https://github.com/floatdrop/read-all-stream/issues" }, "homepage": "https://github.com/floatdrop/read-all-stream#readme", "_id": "read-all-stream@3.0.1", "_shasum": "c3701aecd7c911516677590eedea49684c62fa47", "_resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.0.1.tgz", "_from": "read-all-stream@>=3.0.0 <4.0.0" }