mirror of
https://github.com/JonasunderscoreJones/aka-worker.git
synced 2025-10-23 09:59:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
parent
8cb86120f1
commit
fff961078a
1777 changed files with 1011798 additions and 0 deletions
22
cool-dawn-3d3b/node_modules/decompress-response/index.d.ts
generated
vendored
Normal file
22
cool-dawn-3d3b/node_modules/decompress-response/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/// <reference types="node"/>
|
||||
import {IncomingMessage} from 'http';
|
||||
|
||||
/**
|
||||
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);
|
||||
});
|
||||
```
|
||||
*/
|
||||
declare function decompressResponse(response: IncomingMessage): IncomingMessage;
|
||||
|
||||
export = decompressResponse;
|
58
cool-dawn-3d3b/node_modules/decompress-response/index.js
generated
vendored
Normal file
58
cool-dawn-3d3b/node_modules/decompress-response/index.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
'use strict';
|
||||
const {Transform, PassThrough} = require('stream');
|
||||
const zlib = require('zlib');
|
||||
const mimicResponse = require('mimic-response');
|
||||
|
||||
module.exports = response => {
|
||||
const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
|
||||
|
||||
if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
|
||||
return response;
|
||||
}
|
||||
|
||||
// TODO: Remove this when targeting Node.js 12.
|
||||
const isBrotli = contentEncoding === 'br';
|
||||
if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
|
||||
response.destroy(new Error('Brotli is not supported on Node.js < 12'));
|
||||
return response;
|
||||
}
|
||||
|
||||
let isEmpty = true;
|
||||
|
||||
const checker = new Transform({
|
||||
transform(data, _encoding, callback) {
|
||||
isEmpty = false;
|
||||
|
||||
callback(null, data);
|
||||
},
|
||||
|
||||
flush(callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
|
||||
const finalStream = new PassThrough({
|
||||
autoDestroy: false,
|
||||
destroy(error, callback) {
|
||||
response.destroy();
|
||||
|
||||
callback(error);
|
||||
}
|
||||
});
|
||||
|
||||
const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
|
||||
|
||||
decompressStream.once('error', error => {
|
||||
if (isEmpty && !response.readable) {
|
||||
finalStream.end();
|
||||
return;
|
||||
}
|
||||
|
||||
finalStream.destroy(error);
|
||||
});
|
||||
|
||||
mimicResponse(response, finalStream);
|
||||
response.pipe(checker).pipe(decompressStream).pipe(finalStream);
|
||||
|
||||
return finalStream;
|
||||
};
|
9
cool-dawn-3d3b/node_modules/decompress-response/license
generated
vendored
Normal file
9
cool-dawn-3d3b/node_modules/decompress-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.
|
56
cool-dawn-3d3b/node_modules/decompress-response/package.json
generated
vendored
Normal file
56
cool-dawn-3d3b/node_modules/decompress-response/package.json
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "decompress-response",
|
||||
"version": "6.0.0",
|
||||
"description": "Decompress a HTTP response if needed",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/decompress-response",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"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": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.1",
|
||||
"ava": "^2.2.0",
|
||||
"get-stream": "^5.0.0",
|
||||
"pify": "^5.0.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.30.0"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"@typescript-eslint/prefer-readonly-parameter-types": "off"
|
||||
}
|
||||
}
|
||||
}
|
48
cool-dawn-3d3b/node_modules/decompress-response/readme.md
generated
vendored
Normal file
48
cool-dawn-3d3b/node_modules/decompress-response/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
# decompress-response [](https://travis-ci.com/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-decompress-response?utm_source=npm-decompress-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>
|
Loading…
Add table
Add a link
Reference in a new issue