{
  "manifest": {
    "name": "get-stream",
    "version": "6.0.1",
    "description": "Get a stream as a string, buffer, or array",
    "license": "MIT",
    "repository": {
      "type": "git",
      "url": "https://github.com/sindresorhus/get-stream.git"
    },
    "funding": "https://github.com/sponsors/sindresorhus",
    "author": {
      "name": "Sindre Sorhus",
      "email": "sindresorhus@gmail.com",
      "url": "https://sindresorhus.com"
    },
    "engines": {
      "node": ">=10"
    },
    "scripts": {
      "test": "xo && ava && tsd"
    },
    "files": [
      "index.js",
      "index.d.ts",
      "buffer-stream.js"
    ],
    "keywords": [
      "get",
      "stream",
      "promise",
      "concat",
      "string",
      "text",
      "buffer",
      "read",
      "data",
      "consume",
      "readable",
      "readablestream",
      "array",
      "object"
    ],
    "devDependencies": {
      "@types/node": "^14.0.27",
      "ava": "^2.4.0",
      "into-stream": "^5.0.0",
      "tsd": "^0.13.1",
      "xo": "^0.24.0"
    },
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-get-stream-6.0.1-a262d8eef67aced57c2852ad6167526a43cbf7b7-integrity/node_modules/get-stream/package.json",
    "readmeFilename": "readme.md",
    "readme": "# get-stream\n\n> Get a stream as a string, buffer, or array\n\n## Install\n\n```\n$ npm install get-stream\n```\n\n## Usage\n\n```js\nconst fs = require('fs');\nconst getStream = require('get-stream');\n\n(async () => {\n\tconst stream = fs.createReadStream('unicorn.txt');\n\n\tconsole.log(await getStream(stream));\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## 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\nType: `object`\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 with a `getStream.MaxBufferError` error.\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## 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\n(async () => {\n\ttry {\n\t\tawait getStream(streamThatErrorsAtTheEnd('unicorn'));\n\t} catch (error) {\n\t\tconsole.log(error.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## Related\n\n- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-get-stream?utm_source=npm-get-stream&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n",
    "licenseText": "MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz",
    "hash": "a262d8eef67aced57c2852ad6167526a43cbf7b7",
    "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
    "registry": "npm",
    "packageName": "get-stream",
    "cacheIntegrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== sha1-omLY7vZ6ztV8KFKtYWdSakPL97c="
  },
  "registry": "npm",
  "hash": "a262d8eef67aced57c2852ad6167526a43cbf7b7"
}