{
"_args": [
[
{
"raw": "get-stream@^3.0.0",
"scope": null,
"escapedName": "get-stream",
"name": "get-stream",
"rawSpec": "^3.0.0",
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/got"
]
],
"_from": "get-stream@>=3.0.0 <4.0.0",
"_id": "get-stream@3.0.0",
"_inCache": true,
"_location": "/get-stream",
"_nodeVersion": "4.6.2",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/get-stream-3.0.0.tgz_1479869385406_0.47692562686279416"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "2.15.11",
"_phantomChildren": {},
"_requested": {
"raw": "get-stream@^3.0.0",
"scope": null,
"escapedName": "get-stream",
"name": "get-stream",
"rawSpec": "^3.0.0",
"spec": ">=3.0.0 <4.0.0",
"type": "range"
},
"_requiredBy": [
"/got"
],
"_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
"_shrinkwrap": null,
"_spec": "get-stream@^3.0.0",
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/got",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/get-stream/issues"
},
"dependencies": {},
"description": "Get a stream as a string, buffer, or array",
"devDependencies": {
"ava": "*",
"into-stream": "^3.0.0",
"xo": "*"
},
"directories": {},
"dist": {
"shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
"tarball": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js",
"buffer-stream.js"
],
"gitHead": "3023bc31dec6680dda4f935a2b320b3a4f18c815",
"homepage": "https://github.com/sindresorhus/get-stream#readme",
"keywords": [
"get",
"stream",
"promise",
"concat",
"string",
"str",
"text",
"buffer",
"read",
"data",
"consume",
"readable",
"readablestream",
"array",
"object",
"obj"
],
"license": "MIT",
"maintainers": [
{
"name": "jamestalmage",
"email": "james@talmage.io"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "get-stream",
"optionalDependencies": {},
"readme": "# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream)\n\n> Get a stream as a string, buffer, or array\n\n\n## Install\n\n```\n$ npm install --save get-stream\n```\n\n\n## Usage\n\n```js\nconst fs = require('fs');\nconst getStream = require('get-stream');\nconst stream = fs.createReadStream('unicorn.txt');\n\ngetStream(stream).then(str => {\n\tconsole.log(str);\n\t/*\n\t ,,))))))));,\n\t __)))))))))))))),\n\t\\|/ -\\(((((''''((((((((.\n\t-*-==//////(('' . `)))))),\n\t/|\\ ))| o ;-. '((((( ,(,\n\t ( `| / ) ;))))' ,_))^;(~\n\t | | | ,))((((_ _____------~~~-. %,;(;(>';'~\n\t o_); ; )))(((` ~---~ `:: \\ %%~~)(v;(`('~\n\t ; ''''```` `: `:::|\\,__,%% );`'; ~\n\t | _ ) / `:|`----' `-'\n\t ______/\\/~ | / /\n\t /~;;.____/;;' / ___--,-( `;;;/\n\t / // _;______;'------~~~~~ /;;/\\ /\n\t // | | / ; \\;;,\\\n\t (<_ | ; /',/-----' _>\n\t \\_| ||_ //~;~~~~~~~~~\n\t `\\_| (,~~\n\t \\~\\\n\t ~~\n\t*/\n});\n```\n\n\n## API\n\nThe methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode.\n\n### getStream(stream, [options])\n\nGet the `stream` as a string.\n\n#### options\n\n##### encoding\n\nType: `string`
\nDefault: `utf8`\n\n[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.\n\n##### maxBuffer\n\nType: `number`
\nDefault: `Infinity`\n\nMaximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.\n\n### getStream.buffer(stream, [options])\n\nGet the `stream` as a buffer.\n\nIt honors the `maxBuffer` option as above, but it refers to byte length rather than string length.\n\n### getStream.array(stream, [options])\n\nGet the `stream` as an array of values.\n\nIt honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:\n\n- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes).\n\n- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array.\n\n- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array.\n\n\n## Errors\n\nIf the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error.\n\n```js\ngetStream(streamThatErrorsAtTheEnd('unicorn'))\n\t.catch(err => {\n\t\tconsole.log(err.bufferedData);\n\t\t//=> 'unicorn'\n\t});\n```\n\n\n## FAQ\n\n### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?\n\nThis module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package.\n\n\n## Related\n\n- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/get-stream.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "3.0.0",
"xo": {
"esnext": true
}
}