UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

123 lines (122 loc) 7.92 kB
{ "_args": [ [ { "raw": "get-stream@^4.0.0", "scope": null, "escapedName": "get-stream", "name": "get-stream", "rawSpec": "^4.0.0", "spec": ">=4.0.0 <5.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/execa" ] ], "_from": "get-stream@>=4.0.0 <5.0.0", "_id": "get-stream@4.0.0", "_inCache": true, "_location": "/get-stream", "_nodeVersion": "8.11.3", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/get-stream_4.0.0_1533887947733_0.9848270807807806" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "6.3.0", "_phantomChildren": {}, "_requested": { "raw": "get-stream@^4.0.0", "scope": null, "escapedName": "get-stream", "name": "get-stream", "rawSpec": "^4.0.0", "spec": ">=4.0.0 <5.0.0", "type": "range" }, "_requiredBy": [ "/execa" ], "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.0.0.tgz", "_shasum": "9e074cb898bd2b9ebabb445a1766d7f43576d977", "_shrinkwrap": null, "_spec": "get-stream@^4.0.0", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/execa", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/get-stream/issues" }, "dependencies": { "pump": "^3.0.0" }, "description": "Get a stream as a string, buffer, or array", "devDependencies": { "ava": "*", "into-stream": "^3.0.0", "xo": "*" }, "directories": {}, "dist": { "integrity": "sha512-FneLKMENeOR7wOK0/ZXCh+lwqtnPwkeunJjRN28LPqzGvNAhYvrTAhXv6xDm4vsJ0M7lcRbIYHQudKsSy2RtSQ==", "shasum": "9e074cb898bd2b9ebabb445a1766d7f43576d977", "tarball": "https://registry.npmjs.org/get-stream/-/get-stream-4.0.0.tgz", "fileCount": 5, "unpackedSize": 7677, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbbUXMCRA9TVsSAnZWagAAr3QQAJasZeqMhzqffOw+HBF9\nEfxhjkOVvkr4RKjz4bvmY/C8SBjBtMrHbzaTo0p8+If3ooEywLj94Z52gQ7q\n6YeWm7bav864fIBsLdjGcw/vK3TgLDxgjODvhPrG9Gby5FUHB0Yv+Zgr58E1\nEl7o3qCfsh2UHB4LcY4e2xwhSMPQIhyjIKz8yUuNiokWP7GmdNRbhMqTvB+6\nq4T6ijngj+kSwY0nZguGIQ/3az4N1wtmlrSVfrNL6h7flGAlzaiZnK9uo0Br\ncQ4t3DeYe/pMOQJ//rI+N4t0OOACg9IoCRm9Wmcaw7PB7QtJmsj0I36EYL5r\nBRUi9BI378Dc5IoRz2//mpUfNXtxsiFJvKvDFOxz6pmcgCNEvq27PRyZV3R5\n7xapCf0uhHiGLWSfAGn2bXPKOMjUvbF6lQYAaBwVc2vDsF2cfOX2adbyx21y\nlqmKsT+tTQbrkQE2pcmYfpVjEWufeWTj9EJyS8MY5TmOIpANRTa+kJD5/poz\nrd5faLEaodCbs/zB1NNL8mnGIsbkj30/HFy1c5Q7TE8DBe/5ePSQAT9Mo9qr\nxO6K1fyAViubWvuY/msrcK5JKwd9A19GmWG/8/ItZOmGR8hE52i4fZRjiaTp\nppyFd9Lc17voTfpYRXzirmMTZZJUSltV3qYwWH7DqHUl3tjeFrqu0YZl6yNa\nYbez\r\n=dW5O\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">=6" }, "files": [ "index.js", "buffer-stream.js" ], "gitHead": "4d1b52a0bac62c0f53f18a7f4bf996689fdf85b6", "homepage": "https://github.com/sindresorhus/get-stream#readme", "keywords": [ "get", "stream", "promise", "concat", "string", "text", "buffer", "read", "data", "consume", "readable", "readablestream", "array", "object" ], "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 get-stream\n```\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\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`<br>\nDefault: `utf8`\n\n[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.\n\n##### maxBuffer\n\nType: `number`<br>\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\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\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": "4.0.0" }