Template Upload
This commit is contained in:
36
node_modules/unzip-response/index.js
generated
vendored
Normal file
36
node_modules/unzip-response/index.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
var PassThrough = require('stream').PassThrough;
|
||||
var zlib = require('zlib');
|
||||
|
||||
module.exports = function (res) {
|
||||
// TODO: use Array#includes when targeting Node.js 6
|
||||
if (['gzip', 'deflate'].indexOf(res.headers['content-encoding']) === -1) {
|
||||
return res;
|
||||
}
|
||||
|
||||
var unzip = zlib.createUnzip();
|
||||
var stream = new PassThrough();
|
||||
|
||||
stream.httpVersion = res.httpVersion;
|
||||
stream.headers = res.headers;
|
||||
stream.rawHeaders = res.rawHeaders;
|
||||
stream.trailers = res.trailers;
|
||||
stream.rawTrailers = res.rawTrailers;
|
||||
stream.setTimeout = res.setTimeout.bind(res);
|
||||
stream.statusCode = res.statusCode;
|
||||
stream.statusMessage = res.statusMessage;
|
||||
stream.socket = res.socket;
|
||||
|
||||
unzip.on('error', function (err) {
|
||||
if (err.code === 'Z_BUF_ERROR') {
|
||||
stream.end();
|
||||
return;
|
||||
}
|
||||
|
||||
stream.emit('error', err);
|
||||
});
|
||||
|
||||
res.pipe(unzip).pipe(stream);
|
||||
|
||||
return stream;
|
||||
};
|
21
node_modules/unzip-response/license
generated
vendored
Normal file
21
node_modules/unzip-response/license
generated
vendored
Normal file
@ -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.
|
101
node_modules/unzip-response/package.json
generated
vendored
Normal file
101
node_modules/unzip-response/package.json
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"unzip-response@^1.0.2",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\got"
|
||||
]
|
||||
],
|
||||
"_from": "unzip-response@>=1.0.2-0 <2.0.0-0",
|
||||
"_id": "unzip-response@1.0.2",
|
||||
"_inCache": true,
|
||||
"_location": "/unzip-response",
|
||||
"_nodeVersion": "0.10.48",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/unzip-response-1.0.2.tgz_1477988883900_0.8392405717168003"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "floatdrop@gmail.com",
|
||||
"name": "floatdrop"
|
||||
},
|
||||
"_npmVersion": "2.15.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "unzip-response",
|
||||
"raw": "unzip-response@^1.0.2",
|
||||
"rawSpec": "^1.0.2",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.2-0 <2.0.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/got"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz",
|
||||
"_shasum": "b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "unzip-response@^1.0.2",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\got",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/unzip-response/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Unzip a HTTP response if needed",
|
||||
"devDependencies": {
|
||||
"ava": "^0.16.0",
|
||||
"get-stream": "^2.3.0",
|
||||
"pify": "^2.3.0",
|
||||
"pinkie-promise": "^2.0.1",
|
||||
"rfpify": "^1.0.0",
|
||||
"xo": "^0.16.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe",
|
||||
"tarball": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "da2d1afca2624505811a58da083c845ebdde2b2f",
|
||||
"homepage": "https://github.com/sindresorhus/unzip-response#readme",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"deflate",
|
||||
"gzip",
|
||||
"http",
|
||||
"incoming",
|
||||
"message",
|
||||
"response",
|
||||
"stream",
|
||||
"unzip",
|
||||
"zlib"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "floatdrop",
|
||||
"email": "floatdrop@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "unzip-response",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/unzip-response.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.2",
|
||||
"xo": {
|
||||
"esnext": false
|
||||
}
|
||||
}
|
29
node_modules/unzip-response/readme.md
generated
vendored
Normal file
29
node_modules/unzip-response/readme.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# unzip-response [](https://travis-ci.org/sindresorhus/unzip-response)
|
||||
|
||||
> Unzip a HTTP response if needed
|
||||
|
||||
Unzips the response from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped/deflated, otherwise just passes it through.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save unzip-response
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const http = require('http');
|
||||
const unzipResponse = require('unzip-response');
|
||||
|
||||
http.get('http://sindresorhus.com', res => {
|
||||
res = unzipResponse(res);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Reference in New Issue
Block a user