mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2025-10-13 18:46:27 +00:00
两个版本的插件
This commit is contained in:
17
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/index.d.ts
generated
vendored
Normal file
17
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {IncomingMessage} from 'http';
|
||||
|
||||
/**
|
||||
Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
Makes `toStream` include the properties from `fromStream`.
|
||||
|
||||
@param fromStream - The stream to copy the properties from.
|
||||
@param toStream - The stream to copy the properties to.
|
||||
@return The same object as `toStream`.
|
||||
*/
|
||||
declare function mimicResponse<T extends NodeJS.ReadableStream>(
|
||||
fromStream: IncomingMessage,
|
||||
toStream: T,
|
||||
): IncomingMessage & T;
|
||||
|
||||
export = mimicResponse;
|
38
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/index.js
generated
vendored
Normal file
38
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
// We define these manually to ensure they're always copied
|
||||
// even if they would move up the prototype chain
|
||||
// https://nodejs.org/api/http.html#http_class_http_incomingmessage
|
||||
const knownProperties = [
|
||||
'aborted',
|
||||
'complete',
|
||||
'destroy',
|
||||
'headers',
|
||||
'httpVersion',
|
||||
'httpVersionMinor',
|
||||
'httpVersionMajor',
|
||||
'method',
|
||||
'rawHeaders',
|
||||
'rawTrailers',
|
||||
'setTimeout',
|
||||
'socket',
|
||||
'statusCode',
|
||||
'statusMessage',
|
||||
'trailers',
|
||||
'url'
|
||||
];
|
||||
|
||||
module.exports = (fromStream, toStream) => {
|
||||
const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties));
|
||||
|
||||
for (const property of fromProperties) {
|
||||
// Don't overwrite existing properties.
|
||||
if (property in toStream) {
|
||||
continue;
|
||||
}
|
||||
|
||||
toStream[property] = typeof fromStream[property] === 'function' ? fromStream[property].bind(fromStream) : fromStream[property];
|
||||
}
|
||||
|
||||
return toStream;
|
||||
};
|
9
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/license
generated
vendored
Normal file
9
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
42
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/package.json
generated
vendored
Normal file
42
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/package.json
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "mimic-response",
|
||||
"version": "2.1.0",
|
||||
"description": "Mimic a Node.js HTTP response stream",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/mimic-response",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"mimic",
|
||||
"response",
|
||||
"stream",
|
||||
"http",
|
||||
"https",
|
||||
"request",
|
||||
"get",
|
||||
"core"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "^0.3.0",
|
||||
"@types/node": "^12.0.0",
|
||||
"ava": "^1.1.0",
|
||||
"create-test-server": "^2.4.0",
|
||||
"pify": "^4.0.1",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
57
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/readme.md
generated
vendored
Normal file
57
ccc-tnt-psd2ui-v2.4.x/node_modules/mimic-response/readme.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# mimic-response [](https://travis-ci.org/sindresorhus/mimic-response)
|
||||
|
||||
> Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install mimic-response
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const stream = require('stream');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
const responseStream = getHttpResponseStream();
|
||||
const myStream = new stream.PassThrough();
|
||||
|
||||
mimicResponse(responseStream, myStream);
|
||||
|
||||
console.log(myStream.statusCode);
|
||||
//=> 200
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### mimicResponse(from, to)
|
||||
|
||||
#### from
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
[Node.js HTTP response stream.](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
|
||||
|
||||
#### to
|
||||
|
||||
Type: `Stream`
|
||||
|
||||
Any stream.
|
||||
|
||||
## Related
|
||||
|
||||
- [mimic-fn](https://github.com/sindresorhus/mimic-fn) - Make a function mimic another one
|
||||
- [clone-response](https://github.com/lukechilds/clone-response) - Clone a Node.js response stream
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-mimic-response?utm_source=npm-mimic-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