mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2025-10-13 18:46:27 +00:00
两个版本的插件
This commit is contained in:
29
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/index.d.ts
generated
vendored
Normal file
29
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <reference types="node"/>
|
||||
import {IncomingMessage} from 'http';
|
||||
|
||||
declare const decompressResponse: {
|
||||
/**
|
||||
Decompress a HTTP response if needed.
|
||||
|
||||
@param response - The HTTP incoming stream with compressed data.
|
||||
@returns The decompressed HTTP response stream.
|
||||
|
||||
@example
|
||||
```
|
||||
import {http} from 'http';
|
||||
import decompressResponse = require('decompress-response');
|
||||
|
||||
http.get('https://sindresorhus.com', response => {
|
||||
response = decompressResponse(response);
|
||||
});
|
||||
```
|
||||
*/
|
||||
(response: IncomingMessage): IncomingMessage;
|
||||
|
||||
// TODO: remove this in the next major version, refactor the whole definition to:
|
||||
// declare function decompressResponse(response: IncomingMessage): IncomingMessage;
|
||||
// export = decompressResponse;
|
||||
default: typeof decompressResponse;
|
||||
};
|
||||
|
||||
export = decompressResponse;
|
40
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/index.js
generated
vendored
Normal file
40
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
const {PassThrough: PassThroughStream} = require('stream');
|
||||
const zlib = require('zlib');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const decompressResponse = response => {
|
||||
const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
|
||||
|
||||
if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
|
||||
return response;
|
||||
}
|
||||
|
||||
const isBrotli = contentEncoding === 'br';
|
||||
if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
|
||||
return response;
|
||||
}
|
||||
|
||||
const decompress = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
|
||||
const stream = new PassThroughStream();
|
||||
|
||||
mimicResponse(response, stream);
|
||||
|
||||
decompress.on('error', error => {
|
||||
// Ignore empty response
|
||||
if (error.code === 'Z_BUF_ERROR') {
|
||||
stream.end();
|
||||
return;
|
||||
}
|
||||
|
||||
stream.emit('error', error);
|
||||
});
|
||||
|
||||
response.pipe(decompress).pipe(stream);
|
||||
|
||||
return stream;
|
||||
};
|
||||
|
||||
module.exports = decompressResponse;
|
||||
// TODO: remove this in the next major version
|
||||
module.exports.default = decompressResponse;
|
9
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/license
generated
vendored
Normal file
9
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
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:
|
||||
|
||||
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.
|
50
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/package.json
generated
vendored
Normal file
50
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/package.json
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "decompress-response",
|
||||
"version": "4.2.1",
|
||||
"description": "Decompress a HTTP response if needed",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/decompress-response",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"decompress",
|
||||
"response",
|
||||
"http",
|
||||
"https",
|
||||
"zlib",
|
||||
"gzip",
|
||||
"zip",
|
||||
"deflate",
|
||||
"unzip",
|
||||
"ungzip",
|
||||
"incoming",
|
||||
"message",
|
||||
"stream",
|
||||
"compressed",
|
||||
"brotli"
|
||||
],
|
||||
"dependencies": {
|
||||
"mimic-response": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.7.1",
|
||||
"ava": "^2.2.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"pify": "^4.0.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
52
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/readme.md
generated
vendored
Normal file
52
ccc-tnt-psd2ui-v2.4.x/node_modules/decompress-response/readme.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# decompress-response [](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, deflated or compressed with Brotli, 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('https://sindresorhus.com', response => {
|
||||
response = decompressResponse(response);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### decompressResponse(response)
|
||||
|
||||
Returns the decompressed HTTP response stream.
|
||||
|
||||
#### response
|
||||
|
||||
Type: [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
The HTTP incoming stream with compressed data.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-unzip-response?utm_source=npm-unzip-response&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Reference in New Issue
Block a user