Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@zkat.tech>2018-10-02 22:34:58 +0300
committerKat Marchán <kzm@zkat.tech>2018-12-11 02:30:30 +0300
commit56fffbff27fe2fae8bef27d946755789ef0d89bd (patch)
tree7a0ae8dda813f0ee3be98d6c08e43031ddcdfddc /node_modules
parent125ff9551595dda9dab2edaef10f4c73ae8e1433 (diff)
get-stream@4.1.0
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/.gitignore1
-rw-r--r--node_modules/execa/node_modules/get-stream/buffer-stream.js51
-rw-r--r--node_modules/execa/node_modules/get-stream/index.js51
-rw-r--r--node_modules/execa/node_modules/get-stream/license21
-rw-r--r--node_modules/execa/node_modules/get-stream/package.json80
-rw-r--r--node_modules/execa/node_modules/get-stream/readme.md117
-rw-r--r--node_modules/get-stream/buffer-stream.js10
-rw-r--r--node_modules/get-stream/index.js61
-rw-r--r--node_modules/get-stream/license20
-rw-r--r--node_modules/get-stream/package.json39
-rw-r--r--node_modules/get-stream/readme.md26
-rw-r--r--node_modules/got/node_modules/get-stream/buffer-stream.js51
-rw-r--r--node_modules/got/node_modules/get-stream/index.js51
-rw-r--r--node_modules/got/node_modules/get-stream/license21
-rw-r--r--node_modules/got/node_modules/get-stream/package.json80
-rw-r--r--node_modules/got/node_modules/get-stream/readme.md117
-rw-r--r--node_modules/pacote/node_modules/get-stream/buffer-stream.js51
-rw-r--r--node_modules/pacote/node_modules/get-stream/index.js51
-rw-r--r--node_modules/pacote/node_modules/get-stream/license21
-rw-r--r--node_modules/pacote/node_modules/get-stream/package.json80
-rw-r--r--node_modules/pacote/node_modules/get-stream/readme.md117
21 files changed, 1034 insertions, 83 deletions
diff --git a/node_modules/.gitignore b/node_modules/.gitignore
index 196f8f120..ab6f39da1 100644
--- a/node_modules/.gitignore
+++ b/node_modules/.gitignore
@@ -84,6 +84,7 @@
/function-loop
/functional-red-black-tree
/get-stdin
+/get-stream
/globals
/globby
/has
diff --git a/node_modules/execa/node_modules/get-stream/buffer-stream.js b/node_modules/execa/node_modules/get-stream/buffer-stream.js
new file mode 100644
index 000000000..ae45d3d9e
--- /dev/null
+++ b/node_modules/execa/node_modules/get-stream/buffer-stream.js
@@ -0,0 +1,51 @@
+'use strict';
+const PassThrough = require('stream').PassThrough;
+
+module.exports = opts => {
+ opts = Object.assign({}, opts);
+
+ const array = opts.array;
+ let encoding = opts.encoding;
+ const buffer = encoding === 'buffer';
+ let objectMode = false;
+
+ if (array) {
+ objectMode = !(encoding || buffer);
+ } else {
+ encoding = encoding || 'utf8';
+ }
+
+ if (buffer) {
+ encoding = null;
+ }
+
+ let len = 0;
+ const ret = [];
+ const stream = new PassThrough({objectMode});
+
+ if (encoding) {
+ stream.setEncoding(encoding);
+ }
+
+ stream.on('data', chunk => {
+ ret.push(chunk);
+
+ if (objectMode) {
+ len = ret.length;
+ } else {
+ len += chunk.length;
+ }
+ });
+
+ stream.getBufferedValue = () => {
+ if (array) {
+ return ret;
+ }
+
+ return buffer ? Buffer.concat(ret, len) : ret.join('');
+ };
+
+ stream.getBufferedLength = () => len;
+
+ return stream;
+};
diff --git a/node_modules/execa/node_modules/get-stream/index.js b/node_modules/execa/node_modules/get-stream/index.js
new file mode 100644
index 000000000..2dc5ee96a
--- /dev/null
+++ b/node_modules/execa/node_modules/get-stream/index.js
@@ -0,0 +1,51 @@
+'use strict';
+const bufferStream = require('./buffer-stream');
+
+function getStream(inputStream, opts) {
+ if (!inputStream) {
+ return Promise.reject(new Error('Expected a stream'));
+ }
+
+ opts = Object.assign({maxBuffer: Infinity}, opts);
+
+ const maxBuffer = opts.maxBuffer;
+ let stream;
+ let clean;
+
+ const p = new Promise((resolve, reject) => {
+ const error = err => {
+ if (err) { // null check
+ err.bufferedData = stream.getBufferedValue();
+ }
+
+ reject(err);
+ };
+
+ stream = bufferStream(opts);
+ inputStream.once('error', error);
+ inputStream.pipe(stream);
+
+ stream.on('data', () => {
+ if (stream.getBufferedLength() > maxBuffer) {
+ reject(new Error('maxBuffer exceeded'));
+ }
+ });
+ stream.once('error', error);
+ stream.on('end', resolve);
+
+ clean = () => {
+ // some streams doesn't implement the `stream.Readable` interface correctly
+ if (inputStream.unpipe) {
+ inputStream.unpipe(stream);
+ }
+ };
+ });
+
+ p.then(clean, clean);
+
+ return p.then(() => stream.getBufferedValue());
+}
+
+module.exports = getStream;
+module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'}));
+module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true}));
diff --git a/node_modules/execa/node_modules/get-stream/license b/node_modules/execa/node_modules/get-stream/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/execa/node_modules/get-stream/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission 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:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE 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.
diff --git a/node_modules/execa/node_modules/get-stream/package.json b/node_modules/execa/node_modules/get-stream/package.json
new file mode 100644
index 000000000..987588836
--- /dev/null
+++ b/node_modules/execa/node_modules/get-stream/package.json
@@ -0,0 +1,80 @@
+{
+ "_from": "get-stream@^3.0.0",
+ "_id": "get-stream@3.0.0",
+ "_inBundle": false,
+ "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "_location": "/execa/get-stream",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "get-stream@^3.0.0",
+ "name": "get-stream",
+ "escapedName": "get-stream",
+ "rawSpec": "^3.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^3.0.0"
+ },
+ "_requiredBy": [
+ "/execa"
+ ],
+ "_resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
+ "_spec": "get-stream@^3.0.0",
+ "_where": "/Users/zkat/Documents/code/work/npm/node_modules/execa",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/get-stream/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Get a stream as a string, buffer, or array",
+ "devDependencies": {
+ "ava": "*",
+ "into-stream": "^3.0.0",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js",
+ "buffer-stream.js"
+ ],
+ "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",
+ "name": "get-stream",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/get-stream.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "3.0.0",
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/execa/node_modules/get-stream/readme.md b/node_modules/execa/node_modules/get-stream/readme.md
new file mode 100644
index 000000000..73b188fb4
--- /dev/null
+++ b/node_modules/execa/node_modules/get-stream/readme.md
@@ -0,0 +1,117 @@
+# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream)
+
+> Get a stream as a string, buffer, or array
+
+
+## Install
+
+```
+$ npm install --save get-stream
+```
+
+
+## Usage
+
+```js
+const fs = require('fs');
+const getStream = require('get-stream');
+const stream = fs.createReadStream('unicorn.txt');
+
+getStream(stream).then(str => {
+ console.log(str);
+ /*
+ ,,))))))));,
+ __)))))))))))))),
+ \|/ -\(((((''''((((((((.
+ -*-==//////(('' . `)))))),
+ /|\ ))| o ;-. '((((( ,(,
+ ( `| / ) ;))))' ,_))^;(~
+ | | | ,))((((_ _____------~~~-. %,;(;(>';'~
+ o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
+ ; ''''```` `: `:::|\,__,%% );`'; ~
+ | _ ) / `:|`----' `-'
+ ______/\/~ | / /
+ /~;;.____/;;' / ___--,-( `;;;/
+ / // _;______;'------~~~~~ /;;/\ /
+ // | | / ; \;;,\
+ (<_ | ; /',/-----' _>
+ \_| ||_ //~;~~~~~~~~~
+ `\_| (,~~
+ \~\
+ ~~
+ */
+});
+```
+
+
+## API
+
+The 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.
+
+### getStream(stream, [options])
+
+Get the `stream` as a string.
+
+#### options
+
+##### encoding
+
+Type: `string`<br>
+Default: `utf8`
+
+[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
+
+##### maxBuffer
+
+Type: `number`<br>
+Default: `Infinity`
+
+Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
+
+### getStream.buffer(stream, [options])
+
+Get the `stream` as a buffer.
+
+It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
+
+### getStream.array(stream, [options])
+
+Get the `stream` as an array of values.
+
+It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
+
+- 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).
+
+- 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.
+
+- 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.
+
+
+## Errors
+
+If 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.
+
+```js
+getStream(streamThatErrorsAtTheEnd('unicorn'))
+ .catch(err => {
+ console.log(err.bufferedData);
+ //=> 'unicorn'
+ });
+```
+
+
+## FAQ
+
+### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
+
+This 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.
+
+
+## Related
+
+- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/get-stream/buffer-stream.js b/node_modules/get-stream/buffer-stream.js
index ae45d3d9e..4121c8e56 100644
--- a/node_modules/get-stream/buffer-stream.js
+++ b/node_modules/get-stream/buffer-stream.js
@@ -1,11 +1,11 @@
'use strict';
-const PassThrough = require('stream').PassThrough;
+const {PassThrough} = require('stream');
-module.exports = opts => {
- opts = Object.assign({}, opts);
+module.exports = options => {
+ options = Object.assign({}, options);
- const array = opts.array;
- let encoding = opts.encoding;
+ const {array} = options;
+ let {encoding} = options;
const buffer = encoding === 'buffer';
let objectMode = false;
diff --git a/node_modules/get-stream/index.js b/node_modules/get-stream/index.js
index 2dc5ee96a..7e5584a63 100644
--- a/node_modules/get-stream/index.js
+++ b/node_modules/get-stream/index.js
@@ -1,51 +1,50 @@
'use strict';
+const pump = require('pump');
const bufferStream = require('./buffer-stream');
-function getStream(inputStream, opts) {
+class MaxBufferError extends Error {
+ constructor() {
+ super('maxBuffer exceeded');
+ this.name = 'MaxBufferError';
+ }
+}
+
+function getStream(inputStream, options) {
if (!inputStream) {
return Promise.reject(new Error('Expected a stream'));
}
- opts = Object.assign({maxBuffer: Infinity}, opts);
+ options = Object.assign({maxBuffer: Infinity}, options);
- const maxBuffer = opts.maxBuffer;
- let stream;
- let clean;
+ const {maxBuffer} = options;
- const p = new Promise((resolve, reject) => {
- const error = err => {
- if (err) { // null check
- err.bufferedData = stream.getBufferedValue();
+ let stream;
+ return new Promise((resolve, reject) => {
+ const rejectPromise = error => {
+ if (error) { // A null check
+ error.bufferedData = stream.getBufferedValue();
}
-
- reject(err);
+ reject(error);
};
- stream = bufferStream(opts);
- inputStream.once('error', error);
- inputStream.pipe(stream);
+ stream = pump(inputStream, bufferStream(options), error => {
+ if (error) {
+ rejectPromise(error);
+ return;
+ }
+
+ resolve();
+ });
stream.on('data', () => {
if (stream.getBufferedLength() > maxBuffer) {
- reject(new Error('maxBuffer exceeded'));
+ rejectPromise(new MaxBufferError());
}
});
- stream.once('error', error);
- stream.on('end', resolve);
-
- clean = () => {
- // some streams doesn't implement the `stream.Readable` interface correctly
- if (inputStream.unpipe) {
- inputStream.unpipe(stream);
- }
- };
- });
-
- p.then(clean, clean);
-
- return p.then(() => stream.getBufferedValue());
+ }).then(() => stream.getBufferedValue());
}
module.exports = getStream;
-module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'}));
-module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true}));
+module.exports.buffer = (stream, options) => getStream(stream, Object.assign({}, options, {encoding: 'buffer'}));
+module.exports.array = (stream, options) => getStream(stream, Object.assign({}, options, {array: true}));
+module.exports.MaxBufferError = MaxBufferError;
diff --git a/node_modules/get-stream/license b/node_modules/get-stream/license
index 654d0bfe9..e7af2f771 100644
--- a/node_modules/get-stream/license
+++ b/node_modules/get-stream/license
@@ -1,21 +1,9 @@
-The MIT License (MIT)
+MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-Permission 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:
+Permission 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:
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-THE 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.
+THE 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.
diff --git a/node_modules/get-stream/package.json b/node_modules/get-stream/package.json
index 3042176e1..f4d9711d2 100644
--- a/node_modules/get-stream/package.json
+++ b/node_modules/get-stream/package.json
@@ -1,29 +1,28 @@
{
- "_from": "get-stream@^3.0.0",
- "_id": "get-stream@3.0.0",
+ "_from": "get-stream@^4.1.0",
+ "_id": "get-stream@4.1.0",
"_inBundle": false,
- "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "_integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"_location": "/get-stream",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
- "raw": "get-stream@^3.0.0",
+ "raw": "get-stream@^4.1.0",
"name": "get-stream",
"escapedName": "get-stream",
- "rawSpec": "^3.0.0",
+ "rawSpec": "^4.1.0",
"saveSpec": null,
- "fetchSpec": "^3.0.0"
+ "fetchSpec": "^4.1.0"
},
"_requiredBy": [
- "/execa",
- "/got",
- "/pacote"
+ "#DEV:/",
+ "#USER"
],
- "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
- "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
- "_spec": "get-stream@^3.0.0",
- "_where": "/Users/rebecca/code/npm/node_modules/pacote",
+ "_resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
+ "_shasum": "c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5",
+ "_spec": "get-stream@^4.1.0",
+ "_where": "/Users/zkat/Documents/code/work/npm",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@@ -33,6 +32,9 @@
"url": "https://github.com/sindresorhus/get-stream/issues"
},
"bundleDependencies": false,
+ "dependencies": {
+ "pump": "^3.0.0"
+ },
"deprecated": false,
"description": "Get a stream as a string, buffer, or array",
"devDependencies": {
@@ -41,7 +43,7 @@
"xo": "*"
},
"engines": {
- "node": ">=4"
+ "node": ">=6"
},
"files": [
"index.js",
@@ -54,7 +56,6 @@
"promise",
"concat",
"string",
- "str",
"text",
"buffer",
"read",
@@ -63,8 +64,7 @@
"readable",
"readablestream",
"array",
- "object",
- "obj"
+ "object"
],
"license": "MIT",
"name": "get-stream",
@@ -75,8 +75,5 @@
"scripts": {
"test": "xo && ava"
},
- "version": "3.0.0",
- "xo": {
- "esnext": true
- }
+ "version": "4.1.0"
}
diff --git a/node_modules/get-stream/readme.md b/node_modules/get-stream/readme.md
index 73b188fb4..b87a4d37c 100644
--- a/node_modules/get-stream/readme.md
+++ b/node_modules/get-stream/readme.md
@@ -6,7 +6,7 @@
## Install
```
-$ npm install --save get-stream
+$ npm install get-stream
```
@@ -15,10 +15,11 @@ $ npm install --save get-stream
```js
const fs = require('fs');
const getStream = require('get-stream');
-const stream = fs.createReadStream('unicorn.txt');
-getStream(stream).then(str => {
- console.log(str);
+(async () => {
+ const stream = fs.createReadStream('unicorn.txt');
+
+ console.log(await getStream(stream));
/*
,,))))))));,
__)))))))))))))),
@@ -40,7 +41,7 @@ getStream(stream).then(str => {
\~\
~~
*/
-});
+})();
```
@@ -54,6 +55,8 @@ Get the `stream` as a string.
#### options
+Type: `Object`
+
##### encoding
Type: `string`<br>
@@ -66,7 +69,7 @@ Default: `utf8`
Type: `number`<br>
Default: `Infinity`
-Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
+Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected with a `getStream.MaxBufferError` error.
### getStream.buffer(stream, [options])
@@ -92,11 +95,14 @@ It honors both the `maxBuffer` and `encoding` options. The behavior changes slig
If 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.
```js
-getStream(streamThatErrorsAtTheEnd('unicorn'))
- .catch(err => {
- console.log(err.bufferedData);
+(async () => {
+ try {
+ await getStream(streamThatErrorsAtTheEnd('unicorn'));
+ } catch (error) {
+ console.log(error.bufferedData);
//=> 'unicorn'
- });
+ }
+})()
```
diff --git a/node_modules/got/node_modules/get-stream/buffer-stream.js b/node_modules/got/node_modules/get-stream/buffer-stream.js
new file mode 100644
index 000000000..ae45d3d9e
--- /dev/null
+++ b/node_modules/got/node_modules/get-stream/buffer-stream.js
@@ -0,0 +1,51 @@
+'use strict';
+const PassThrough = require('stream').PassThrough;
+
+module.exports = opts => {
+ opts = Object.assign({}, opts);
+
+ const array = opts.array;
+ let encoding = opts.encoding;
+ const buffer = encoding === 'buffer';
+ let objectMode = false;
+
+ if (array) {
+ objectMode = !(encoding || buffer);
+ } else {
+ encoding = encoding || 'utf8';
+ }
+
+ if (buffer) {
+ encoding = null;
+ }
+
+ let len = 0;
+ const ret = [];
+ const stream = new PassThrough({objectMode});
+
+ if (encoding) {
+ stream.setEncoding(encoding);
+ }
+
+ stream.on('data', chunk => {
+ ret.push(chunk);
+
+ if (objectMode) {
+ len = ret.length;
+ } else {
+ len += chunk.length;
+ }
+ });
+
+ stream.getBufferedValue = () => {
+ if (array) {
+ return ret;
+ }
+
+ return buffer ? Buffer.concat(ret, len) : ret.join('');
+ };
+
+ stream.getBufferedLength = () => len;
+
+ return stream;
+};
diff --git a/node_modules/got/node_modules/get-stream/index.js b/node_modules/got/node_modules/get-stream/index.js
new file mode 100644
index 000000000..2dc5ee96a
--- /dev/null
+++ b/node_modules/got/node_modules/get-stream/index.js
@@ -0,0 +1,51 @@
+'use strict';
+const bufferStream = require('./buffer-stream');
+
+function getStream(inputStream, opts) {
+ if (!inputStream) {
+ return Promise.reject(new Error('Expected a stream'));
+ }
+
+ opts = Object.assign({maxBuffer: Infinity}, opts);
+
+ const maxBuffer = opts.maxBuffer;
+ let stream;
+ let clean;
+
+ const p = new Promise((resolve, reject) => {
+ const error = err => {
+ if (err) { // null check
+ err.bufferedData = stream.getBufferedValue();
+ }
+
+ reject(err);
+ };
+
+ stream = bufferStream(opts);
+ inputStream.once('error', error);
+ inputStream.pipe(stream);
+
+ stream.on('data', () => {
+ if (stream.getBufferedLength() > maxBuffer) {
+ reject(new Error('maxBuffer exceeded'));
+ }
+ });
+ stream.once('error', error);
+ stream.on('end', resolve);
+
+ clean = () => {
+ // some streams doesn't implement the `stream.Readable` interface correctly
+ if (inputStream.unpipe) {
+ inputStream.unpipe(stream);
+ }
+ };
+ });
+
+ p.then(clean, clean);
+
+ return p.then(() => stream.getBufferedValue());
+}
+
+module.exports = getStream;
+module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'}));
+module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true}));
diff --git a/node_modules/got/node_modules/get-stream/license b/node_modules/got/node_modules/get-stream/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/got/node_modules/get-stream/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission 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:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE 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.
diff --git a/node_modules/got/node_modules/get-stream/package.json b/node_modules/got/node_modules/get-stream/package.json
new file mode 100644
index 000000000..e8eb49840
--- /dev/null
+++ b/node_modules/got/node_modules/get-stream/package.json
@@ -0,0 +1,80 @@
+{
+ "_from": "get-stream@^3.0.0",
+ "_id": "get-stream@3.0.0",
+ "_inBundle": false,
+ "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "_location": "/got/get-stream",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "get-stream@^3.0.0",
+ "name": "get-stream",
+ "escapedName": "get-stream",
+ "rawSpec": "^3.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^3.0.0"
+ },
+ "_requiredBy": [
+ "/got"
+ ],
+ "_resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
+ "_spec": "get-stream@^3.0.0",
+ "_where": "/Users/zkat/Documents/code/work/npm/node_modules/got",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/get-stream/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Get a stream as a string, buffer, or array",
+ "devDependencies": {
+ "ava": "*",
+ "into-stream": "^3.0.0",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js",
+ "buffer-stream.js"
+ ],
+ "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",
+ "name": "get-stream",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/get-stream.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "3.0.0",
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/got/node_modules/get-stream/readme.md b/node_modules/got/node_modules/get-stream/readme.md
new file mode 100644
index 000000000..73b188fb4
--- /dev/null
+++ b/node_modules/got/node_modules/get-stream/readme.md
@@ -0,0 +1,117 @@
+# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream)
+
+> Get a stream as a string, buffer, or array
+
+
+## Install
+
+```
+$ npm install --save get-stream
+```
+
+
+## Usage
+
+```js
+const fs = require('fs');
+const getStream = require('get-stream');
+const stream = fs.createReadStream('unicorn.txt');
+
+getStream(stream).then(str => {
+ console.log(str);
+ /*
+ ,,))))))));,
+ __)))))))))))))),
+ \|/ -\(((((''''((((((((.
+ -*-==//////(('' . `)))))),
+ /|\ ))| o ;-. '((((( ,(,
+ ( `| / ) ;))))' ,_))^;(~
+ | | | ,))((((_ _____------~~~-. %,;(;(>';'~
+ o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
+ ; ''''```` `: `:::|\,__,%% );`'; ~
+ | _ ) / `:|`----' `-'
+ ______/\/~ | / /
+ /~;;.____/;;' / ___--,-( `;;;/
+ / // _;______;'------~~~~~ /;;/\ /
+ // | | / ; \;;,\
+ (<_ | ; /',/-----' _>
+ \_| ||_ //~;~~~~~~~~~
+ `\_| (,~~
+ \~\
+ ~~
+ */
+});
+```
+
+
+## API
+
+The 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.
+
+### getStream(stream, [options])
+
+Get the `stream` as a string.
+
+#### options
+
+##### encoding
+
+Type: `string`<br>
+Default: `utf8`
+
+[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
+
+##### maxBuffer
+
+Type: `number`<br>
+Default: `Infinity`
+
+Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
+
+### getStream.buffer(stream, [options])
+
+Get the `stream` as a buffer.
+
+It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
+
+### getStream.array(stream, [options])
+
+Get the `stream` as an array of values.
+
+It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
+
+- 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).
+
+- 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.
+
+- 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.
+
+
+## Errors
+
+If 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.
+
+```js
+getStream(streamThatErrorsAtTheEnd('unicorn'))
+ .catch(err => {
+ console.log(err.bufferedData);
+ //=> 'unicorn'
+ });
+```
+
+
+## FAQ
+
+### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
+
+This 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.
+
+
+## Related
+
+- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/pacote/node_modules/get-stream/buffer-stream.js b/node_modules/pacote/node_modules/get-stream/buffer-stream.js
new file mode 100644
index 000000000..ae45d3d9e
--- /dev/null
+++ b/node_modules/pacote/node_modules/get-stream/buffer-stream.js
@@ -0,0 +1,51 @@
+'use strict';
+const PassThrough = require('stream').PassThrough;
+
+module.exports = opts => {
+ opts = Object.assign({}, opts);
+
+ const array = opts.array;
+ let encoding = opts.encoding;
+ const buffer = encoding === 'buffer';
+ let objectMode = false;
+
+ if (array) {
+ objectMode = !(encoding || buffer);
+ } else {
+ encoding = encoding || 'utf8';
+ }
+
+ if (buffer) {
+ encoding = null;
+ }
+
+ let len = 0;
+ const ret = [];
+ const stream = new PassThrough({objectMode});
+
+ if (encoding) {
+ stream.setEncoding(encoding);
+ }
+
+ stream.on('data', chunk => {
+ ret.push(chunk);
+
+ if (objectMode) {
+ len = ret.length;
+ } else {
+ len += chunk.length;
+ }
+ });
+
+ stream.getBufferedValue = () => {
+ if (array) {
+ return ret;
+ }
+
+ return buffer ? Buffer.concat(ret, len) : ret.join('');
+ };
+
+ stream.getBufferedLength = () => len;
+
+ return stream;
+};
diff --git a/node_modules/pacote/node_modules/get-stream/index.js b/node_modules/pacote/node_modules/get-stream/index.js
new file mode 100644
index 000000000..2dc5ee96a
--- /dev/null
+++ b/node_modules/pacote/node_modules/get-stream/index.js
@@ -0,0 +1,51 @@
+'use strict';
+const bufferStream = require('./buffer-stream');
+
+function getStream(inputStream, opts) {
+ if (!inputStream) {
+ return Promise.reject(new Error('Expected a stream'));
+ }
+
+ opts = Object.assign({maxBuffer: Infinity}, opts);
+
+ const maxBuffer = opts.maxBuffer;
+ let stream;
+ let clean;
+
+ const p = new Promise((resolve, reject) => {
+ const error = err => {
+ if (err) { // null check
+ err.bufferedData = stream.getBufferedValue();
+ }
+
+ reject(err);
+ };
+
+ stream = bufferStream(opts);
+ inputStream.once('error', error);
+ inputStream.pipe(stream);
+
+ stream.on('data', () => {
+ if (stream.getBufferedLength() > maxBuffer) {
+ reject(new Error('maxBuffer exceeded'));
+ }
+ });
+ stream.once('error', error);
+ stream.on('end', resolve);
+
+ clean = () => {
+ // some streams doesn't implement the `stream.Readable` interface correctly
+ if (inputStream.unpipe) {
+ inputStream.unpipe(stream);
+ }
+ };
+ });
+
+ p.then(clean, clean);
+
+ return p.then(() => stream.getBufferedValue());
+}
+
+module.exports = getStream;
+module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'}));
+module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true}));
diff --git a/node_modules/pacote/node_modules/get-stream/license b/node_modules/pacote/node_modules/get-stream/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/pacote/node_modules/get-stream/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission 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:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE 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.
diff --git a/node_modules/pacote/node_modules/get-stream/package.json b/node_modules/pacote/node_modules/get-stream/package.json
new file mode 100644
index 000000000..4a0655969
--- /dev/null
+++ b/node_modules/pacote/node_modules/get-stream/package.json
@@ -0,0 +1,80 @@
+{
+ "_from": "get-stream@^3.0.0",
+ "_id": "get-stream@3.0.0",
+ "_inBundle": false,
+ "_integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
+ "_location": "/pacote/get-stream",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "get-stream@^3.0.0",
+ "name": "get-stream",
+ "escapedName": "get-stream",
+ "rawSpec": "^3.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^3.0.0"
+ },
+ "_requiredBy": [
+ "/pacote"
+ ],
+ "_resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "_shasum": "8e943d1358dc37555054ecbe2edb05aa174ede14",
+ "_spec": "get-stream@^3.0.0",
+ "_where": "/Users/zkat/Documents/code/work/npm/node_modules/pacote",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/get-stream/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Get a stream as a string, buffer, or array",
+ "devDependencies": {
+ "ava": "*",
+ "into-stream": "^3.0.0",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js",
+ "buffer-stream.js"
+ ],
+ "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",
+ "name": "get-stream",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/get-stream.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "3.0.0",
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/pacote/node_modules/get-stream/readme.md b/node_modules/pacote/node_modules/get-stream/readme.md
new file mode 100644
index 000000000..73b188fb4
--- /dev/null
+++ b/node_modules/pacote/node_modules/get-stream/readme.md
@@ -0,0 +1,117 @@
+# get-stream [![Build Status](https://travis-ci.org/sindresorhus/get-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stream)
+
+> Get a stream as a string, buffer, or array
+
+
+## Install
+
+```
+$ npm install --save get-stream
+```
+
+
+## Usage
+
+```js
+const fs = require('fs');
+const getStream = require('get-stream');
+const stream = fs.createReadStream('unicorn.txt');
+
+getStream(stream).then(str => {
+ console.log(str);
+ /*
+ ,,))))))));,
+ __)))))))))))))),
+ \|/ -\(((((''''((((((((.
+ -*-==//////(('' . `)))))),
+ /|\ ))| o ;-. '((((( ,(,
+ ( `| / ) ;))))' ,_))^;(~
+ | | | ,))((((_ _____------~~~-. %,;(;(>';'~
+ o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
+ ; ''''```` `: `:::|\,__,%% );`'; ~
+ | _ ) / `:|`----' `-'
+ ______/\/~ | / /
+ /~;;.____/;;' / ___--,-( `;;;/
+ / // _;______;'------~~~~~ /;;/\ /
+ // | | / ; \;;,\
+ (<_ | ; /',/-----' _>
+ \_| ||_ //~;~~~~~~~~~
+ `\_| (,~~
+ \~\
+ ~~
+ */
+});
+```
+
+
+## API
+
+The 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.
+
+### getStream(stream, [options])
+
+Get the `stream` as a string.
+
+#### options
+
+##### encoding
+
+Type: `string`<br>
+Default: `utf8`
+
+[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
+
+##### maxBuffer
+
+Type: `number`<br>
+Default: `Infinity`
+
+Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
+
+### getStream.buffer(stream, [options])
+
+Get the `stream` as a buffer.
+
+It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
+
+### getStream.array(stream, [options])
+
+Get the `stream` as an array of values.
+
+It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
+
+- 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).
+
+- 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.
+
+- 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.
+
+
+## Errors
+
+If 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.
+
+```js
+getStream(streamThatErrorsAtTheEnd('unicorn'))
+ .catch(err => {
+ console.log(err.bufferedData);
+ //=> 'unicorn'
+ });
+```
+
+
+## FAQ
+
+### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
+
+This 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.
+
+
+## Related
+
+- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)