UNPKG

pnpm

Version:

Fast, disk space efficient package manager

123 lines (122 loc) 7.97 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/zoltan/src/pnpm/pnpm/packages/pnpm/node_modules/execa" ] ], "_from": "get-stream@^4.0.0", "_hasShrinkwrap": false, "_id": "get-stream@4.1.0", "_location": "/get-stream", "_nodeVersion": "10.11.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/get-stream_4.1.0_1538471503599_0.7289635831880876" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "6.4.1", "_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.1.0.tgz", "_shasum": "c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5", "_shrinkwrap": null, "_spec": "get-stream@^4.0.0", "_where": "/home/zoltan/src/pnpm/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-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "shasum": "c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5", "tarball": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "fileCount": 5, "unpackedSize": 7877, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbszZQCRA9TVsSAnZWagAAIHsP/3QXvMkXi+6qIzjHY2xs\n4iRqSd7jFgg/5Ceonz87k+Siu9ogewx7aHE5umhfG+4P9WyTjZObby+nYjFq\n622wXR/4JKBZvUfEs2jcLNHwJ6pIRVohXhjbHrvJ5yoA2ZBhSRtw5NR8ZMCD\nTitujVKdx8dunoDWbAtJ6sIF409mO6jC4Ff+U0NuaUmt4eIalzXbBJBu/FX+\nrJeuiisWBjzXVY1E5k5LRmJoLQdNd0rL4s8/sbyPQpeYnJQ6TW1Z5AlwW9NI\nx8WzDfkS9V550tbJmTJBI1yUJgWk1kZ6cpKCOmtiFGVpp96j5tdZ7e9QeYq3\nFvlvSvIbrFLo2NjMoS3vrCKd9naYIK9o4gg1dOto1CPIz08VwkD+6BMenKgr\nAfcGLYaMov7C10dg2agqL0M2Z4gUeTiU0jydxBLObFFDSy/h/fXLu2ObXvQ/\nA6jRvKBOQFj5kwz2qvIxFesTTTm5tuL2tZs6NvxPy46LlTcc+ORYR5o4fDJi\nxqCV8aUc4QqwbInCr1lU8m86WuC/Knu05MVN4GlSIMecgsFzhox7bc5DmzZF\n6feXxXjBBj8+ZqtbvXjw9njYZ4cj4cnk7FDsIj+qYpF5wyzTaryynGyU9kij\nHAK3IcLNHmkjeK2ojUs33Pr1rzZJVg/UPL3Y8nCgf8pR1OK86KWPT4K2We8C\nVzZd\r\n=xvDa\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">=6" }, "files": [ "index.js", "buffer-stream.js" ], "gitHead": "9ddd965a50132bd70ad42befbcce08a9005c78f7", "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 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\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.1.0" }