aboutsummaryrefslogtreecommitdiff
path: root/node_modules/decompress-response
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-04-09 16:39:03 +0200
committerMinteck <contact@minteck.org>2022-04-09 16:40:02 +0200
commit0f8967b9113d698cdeb2d05ca85d2d9a80461c24 (patch)
tree00664ddd9c55a2c33631fd1bd33e556cea9c67e5 /node_modules/decompress-response
parentdac03ac82bc0f8044a4b339c27b5390e4dcecf2f (diff)
downloadvoicer-0f8967b9113d698cdeb2d05ca85d2d9a80461c24.tar.gz
voicer-0f8967b9113d698cdeb2d05ca85d2d9a80461c24.tar.bz2
voicer-0f8967b9113d698cdeb2d05ca85d2d9a80461c24.zip
CommitHEADtrunk
Diffstat (limited to 'node_modules/decompress-response')
-rw-r--r--node_modules/decompress-response/index.js29
-rw-r--r--node_modules/decompress-response/license21
-rw-r--r--node_modules/decompress-response/package.json53
-rw-r--r--node_modules/decompress-response/readme.md31
4 files changed, 134 insertions, 0 deletions
diff --git a/node_modules/decompress-response/index.js b/node_modules/decompress-response/index.js
new file mode 100644
index 0000000..d8acd4a
--- /dev/null
+++ b/node_modules/decompress-response/index.js
@@ -0,0 +1,29 @@
+'use strict';
+const PassThrough = require('stream').PassThrough;
+const zlib = require('zlib');
+const mimicResponse = require('mimic-response');
+
+module.exports = response => {
+ // TODO: Use Array#includes when targeting Node.js 6
+ if (['gzip', 'deflate'].indexOf(response.headers['content-encoding']) === -1) {
+ return response;
+ }
+
+ const unzip = zlib.createUnzip();
+ const stream = new PassThrough();
+
+ mimicResponse(response, stream);
+
+ unzip.on('error', err => {
+ if (err.code === 'Z_BUF_ERROR') {
+ stream.end();
+ return;
+ }
+
+ stream.emit('error', err);
+ });
+
+ response.pipe(unzip).pipe(stream);
+
+ return stream;
+};
diff --git a/node_modules/decompress-response/license b/node_modules/decompress-response/license
new file mode 100644
index 0000000..32a16ce
--- /dev/null
+++ b/node_modules/decompress-response/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/decompress-response/package.json b/node_modules/decompress-response/package.json
new file mode 100644
index 0000000..3574dc2
--- /dev/null
+++ b/node_modules/decompress-response/package.json
@@ -0,0 +1,53 @@
+{
+ "name": "decompress-response",
+ "version": "3.3.0",
+ "description": "Decompress a HTTP response if needed",
+ "license": "MIT",
+ "repository": "sindresorhus/decompress-response",
+ "maintainers": [
+ {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ {
+ "name": "Vsevolod Strukchinsky",
+ "email": "floatdrop@gmail.com",
+ "url": "github.com/floatdrop"
+ }
+ ],
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "decompress",
+ "response",
+ "http",
+ "https",
+ "zlib",
+ "gzip",
+ "zip",
+ "deflate",
+ "unzip",
+ "ungzip",
+ "incoming",
+ "message",
+ "stream",
+ "compressed"
+ ],
+ "dependencies": {
+ "mimic-response": "^1.0.0"
+ },
+ "devDependencies": {
+ "ava": "*",
+ "get-stream": "^3.0.0",
+ "pify": "^3.0.0",
+ "xo": "*"
+ }
+}
diff --git a/node_modules/decompress-response/readme.md b/node_modules/decompress-response/readme.md
new file mode 100644
index 0000000..1b98767
--- /dev/null
+++ b/node_modules/decompress-response/readme.md
@@ -0,0 +1,31 @@
+# decompress-response [![Build Status](https://travis-ci.org/sindresorhus/decompress-response.svg?branch=master)](https://travis-ci.org/sindresorhus/decompress-response)
+
+> Decompress a HTTP response if needed
+
+Decompresses the [response](https://nodejs.org/api/http.html#http_class_http_incomingmessage) from [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) if it's gzipped or deflated, otherwise just passes it through.
+
+Used by [`got`](https://github.com/sindresorhus/got).
+
+
+## Install
+
+```
+$ npm install decompress-response
+```
+
+
+## Usage
+
+```js
+const http = require('http');
+const decompressResponse = require('decompress-response');
+
+http.get('http://sindresorhus.com', response => {
+ response = decompressResponse(response);
+});
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)