aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/minizlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--node_modules/minizlib/LICENSE26
-rw-r--r--node_modules/minizlib/README.md64
-rw-r--r--node_modules/minizlib/dist/commonjs/constants.d.ts2
-rw-r--r--node_modules/minizlib/dist/commonjs/constants.js123
-rw-r--r--node_modules/minizlib/dist/commonjs/index.d.ts99
-rw-r--r--node_modules/minizlib/dist/commonjs/index.js416
-rw-r--r--node_modules/minizlib/dist/commonjs/package.json3
-rw-r--r--node_modules/minizlib/dist/esm/constants.d.ts2
-rw-r--r--node_modules/minizlib/dist/esm/constants.js117
-rw-r--r--node_modules/minizlib/dist/esm/index.d.ts99
-rw-r--r--node_modules/minizlib/dist/esm/index.js363
-rw-r--r--node_modules/minizlib/dist/esm/package.json3
-rw-r--r--node_modules/minizlib/package.json80
13 files changed, 1397 insertions, 0 deletions
diff --git a/node_modules/minizlib/LICENSE b/node_modules/minizlib/LICENSE
new file mode 100644
index 0000000..49f7efe
--- /dev/null
+++ b/node_modules/minizlib/LICENSE
@@ -0,0 +1,26 @@
+Minizlib was created by Isaac Z. Schlueter.
+It is a derivative work of the Node.js project.
+
+"""
+Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
+Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
+Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
+
+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/minizlib/README.md b/node_modules/minizlib/README.md
new file mode 100644
index 0000000..1b6f008
--- /dev/null
+++ b/node_modules/minizlib/README.md
@@ -0,0 +1,64 @@
+# minizlib
+
+A fast zlib stream built on [minipass](http://npm.im/minipass) and
+Node.js's zlib binding.
+
+This module was created to serve the needs of
+[node-tar](http://npm.im/tar) and
+[minipass-fetch](http://npm.im/minipass-fetch).
+
+Brotli is supported in versions of node with a Brotli binding.
+
+## How does this differ from the streams in `'node:zlib'`?
+
+First, there are no convenience methods to compress or decompress a
+buffer. If you want those, use the built-in `zlib` module. This is
+only streams. That being said, Minipass streams to make it fairly easy to
+use as one-liners: `new zlib.Deflate().end(data).read()` will return the
+deflate compressed result.
+
+This module compresses and decompresses the data as fast as you feed
+it in. It is synchronous, and runs on the main process thread. Zlib
+and Brotli operations can be high CPU, but they're very fast, and doing it
+this way means much less bookkeeping and artificial deferral.
+
+Node's built in zlib streams are built on top of `stream.Transform`.
+They do the maximally safe thing with respect to consistent
+asynchrony, buffering, and backpressure.
+
+See [Minipass](http://npm.im/minipass) for more on the differences between
+Node.js core streams and Minipass streams, and the convenience methods
+provided by that class.
+
+## Classes
+
+- Deflate
+- Inflate
+- Gzip
+- Gunzip
+- DeflateRaw
+- InflateRaw
+- Unzip
+- BrotliCompress (Node v10 and higher)
+- BrotliDecompress (Node v10 and higher)
+- ZstdCompress (Node v22.15 and higher)
+- ZstdDecompress (Node v22.15 and higher)
+
+## USAGE
+
+```js
+import { BrotliDecompress } from 'minizlib'
+// or: const BrotliDecompress = require('minizlib')
+
+const input = sourceOfCompressedData()
+const decode = new BrotliDecompress()
+const output = whereToWriteTheDecodedData()
+input.pipe(decode).pipe(output)
+```
+
+## REPRODUCIBLE BUILDS
+
+To create reproducible gzip compressed files across different operating
+systems, set `portable: true` in the options. This causes minizlib to set
+the `OS` indicator in byte 9 of the extended gzip header to `0xFF` for
+'unknown'.
diff --git a/node_modules/minizlib/dist/commonjs/constants.d.ts b/node_modules/minizlib/dist/commonjs/constants.d.ts
new file mode 100644
index 0000000..67c47b4
--- /dev/null
+++ b/node_modules/minizlib/dist/commonjs/constants.d.ts
@@ -0,0 +1,2 @@
+export declare const constants: any;
+//# sourceMappingURL=constants.d.ts.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/commonjs/constants.js b/node_modules/minizlib/dist/commonjs/constants.js
new file mode 100644
index 0000000..dfc2c19
--- /dev/null
+++ b/node_modules/minizlib/dist/commonjs/constants.js
@@ -0,0 +1,123 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.constants = void 0;
+// Update with any zlib constants that are added or changed in the future.
+// Node v6 didn't export this, so we just hard code the version and rely
+// on all the other hard-coded values from zlib v4736. When node v6
+// support drops, we can just export the realZlibConstants object.
+const zlib_1 = __importDefault(require("zlib"));
+/* c8 ignore start */
+const realZlibConstants = zlib_1.default.constants || { ZLIB_VERNUM: 4736 };
+/* c8 ignore stop */
+exports.constants = Object.freeze(Object.assign(Object.create(null), {
+ Z_NO_FLUSH: 0,
+ Z_PARTIAL_FLUSH: 1,
+ Z_SYNC_FLUSH: 2,
+ Z_FULL_FLUSH: 3,
+ Z_FINISH: 4,
+ Z_BLOCK: 5,
+ Z_OK: 0,
+ Z_STREAM_END: 1,
+ Z_NEED_DICT: 2,
+ Z_ERRNO: -1,
+ Z_STREAM_ERROR: -2,
+ Z_DATA_ERROR: -3,
+ Z_MEM_ERROR: -4,
+ Z_BUF_ERROR: -5,
+ Z_VERSION_ERROR: -6,
+ Z_NO_COMPRESSION: 0,
+ Z_BEST_SPEED: 1,
+ Z_BEST_COMPRESSION: 9,
+ Z_DEFAULT_COMPRESSION: -1,
+ Z_FILTERED: 1,
+ Z_HUFFMAN_ONLY: 2,
+ Z_RLE: 3,
+ Z_FIXED: 4,
+ Z_DEFAULT_STRATEGY: 0,
+ DEFLATE: 1,
+ INFLATE: 2,
+ GZIP: 3,
+ GUNZIP: 4,
+ DEFLATERAW: 5,
+ INFLATERAW: 6,
+ UNZIP: 7,
+ BROTLI_DECODE: 8,
+ BROTLI_ENCODE: 9,
+ Z_MIN_WINDOWBITS: 8,
+ Z_MAX_WINDOWBITS: 15,
+ Z_DEFAULT_WINDOWBITS: 15,
+ Z_MIN_CHUNK: 64,
+ Z_MAX_CHUNK: Infinity,
+ Z_DEFAULT_CHUNK: 16384,
+ Z_MIN_MEMLEVEL: 1,
+ Z_MAX_MEMLEVEL: 9,
+ Z_DEFAULT_MEMLEVEL: 8,
+ Z_MIN_LEVEL: -1,
+ Z_MAX_LEVEL: 9,
+ Z_DEFAULT_LEVEL: -1,
+ BROTLI_OPERATION_PROCESS: 0,
+ BROTLI_OPERATION_FLUSH: 1,
+ BROTLI_OPERATION_FINISH: 2,
+ BROTLI_OPERATION_EMIT_METADATA: 3,
+ BROTLI_MODE_GENERIC: 0,
+ BROTLI_MODE_TEXT: 1,
+ BROTLI_MODE_FONT: 2,
+ BROTLI_DEFAULT_MODE: 0,
+ BROTLI_MIN_QUALITY: 0,
+ BROTLI_MAX_QUALITY: 11,
+ BROTLI_DEFAULT_QUALITY: 11,
+ BROTLI_MIN_WINDOW_BITS: 10,
+ BROTLI_MAX_WINDOW_BITS: 24,
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
+ BROTLI_DEFAULT_WINDOW: 22,
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
+ BROTLI_PARAM_MODE: 0,
+ BROTLI_PARAM_QUALITY: 1,
+ BROTLI_PARAM_LGWIN: 2,
+ BROTLI_PARAM_LGBLOCK: 3,
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
+ BROTLI_PARAM_SIZE_HINT: 5,
+ BROTLI_PARAM_LARGE_WINDOW: 6,
+ BROTLI_PARAM_NPOSTFIX: 7,
+ BROTLI_PARAM_NDIRECT: 8,
+ BROTLI_DECODER_RESULT_ERROR: 0,
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
+ BROTLI_DECODER_NO_ERROR: 0,
+ BROTLI_DECODER_SUCCESS: 1,
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31,
+}, realZlibConstants));
+//# sourceMappingURL=constants.js.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/commonjs/index.d.ts b/node_modules/minizlib/dist/commonjs/index.d.ts
new file mode 100644
index 0000000..8044bd0
--- /dev/null
+++ b/node_modules/minizlib/dist/commonjs/index.d.ts
@@ -0,0 +1,99 @@
+import { Buffer } from 'buffer';
+import { Minipass } from 'minipass';
+import * as realZlib from 'zlib';
+export { constants } from './constants.js';
+declare const _superWrite: unique symbol;
+export declare class ZlibError extends Error {
+ code?: string;
+ errno?: number;
+ constructor(err: NodeJS.ErrnoException | Error, origin?: Function);
+ get name(): string;
+}
+declare const _flushFlag: unique symbol;
+export type ChunkWithFlushFlag = Minipass.ContiguousData & {
+ [_flushFlag]?: number;
+};
+export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
+ flush?: number;
+ finishFlush?: number;
+ fullFlushFlag?: number;
+};
+export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
+export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
+export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
+export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
+declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
+ #private;
+ get sawError(): boolean;
+ get handle(): ZlibHandle | undefined;
+ get flushFlag(): number;
+ constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode);
+ close(): void;
+ reset(): any;
+ flush(flushFlag?: number): void;
+ end(cb?: () => void): this;
+ end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
+ end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
+ get ended(): boolean;
+ [_superWrite](data: Buffer & {
+ [_flushFlag]?: number;
+ }): boolean;
+ write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
+ write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
+}
+export type ZlibOptions = ZlibBaseOptions & {
+ level?: number;
+ strategy?: number;
+};
+export declare class Zlib extends ZlibBase {
+ #private;
+ constructor(opts: ZlibOptions, mode: ZlibMode);
+ params(level: number, strategy: number): void;
+}
+export declare class Deflate extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class Inflate extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export type GzipOptions = ZlibOptions & {
+ portable?: boolean;
+};
+export declare class Gzip extends Zlib {
+ #private;
+ constructor(opts: GzipOptions);
+ [_superWrite](data: Buffer & {
+ [_flushFlag]?: number;
+ }): boolean;
+}
+export declare class Gunzip extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class DeflateRaw extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class InflateRaw extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class Unzip extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+declare class Brotli extends ZlibBase {
+ constructor(opts: ZlibOptions, mode: BrotliMode);
+}
+export declare class BrotliCompress extends Brotli {
+ constructor(opts: ZlibOptions);
+}
+export declare class BrotliDecompress extends Brotli {
+ constructor(opts: ZlibOptions);
+}
+declare class Zstd extends ZlibBase {
+ constructor(opts: ZlibOptions, mode: ZstdMode);
+}
+export declare class ZstdCompress extends Zstd {
+ constructor(opts: ZlibOptions);
+}
+export declare class ZstdDecompress extends Zstd {
+ constructor(opts: ZlibOptions);
+}
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/commonjs/index.js b/node_modules/minizlib/dist/commonjs/index.js
new file mode 100644
index 0000000..78c6536
--- /dev/null
+++ b/node_modules/minizlib/dist/commonjs/index.js
@@ -0,0 +1,416 @@
+"use strict";
+var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ var desc = Object.getOwnPropertyDescriptor(m, k);
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
+ desc = { enumerable: true, get: function() { return m[k]; } };
+ }
+ Object.defineProperty(o, k2, desc);
+}) : (function(o, m, k, k2) {
+ if (k2 === undefined) k2 = k;
+ o[k2] = m[k];
+}));
+var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
+}) : function(o, v) {
+ o["default"] = v;
+});
+var __importStar = (this && this.__importStar) || (function () {
+ var ownKeys = function(o) {
+ ownKeys = Object.getOwnPropertyNames || function (o) {
+ var ar = [];
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
+ return ar;
+ };
+ return ownKeys(o);
+ };
+ return function (mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
+ __setModuleDefault(result, mod);
+ return result;
+ };
+})();
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.ZstdDecompress = exports.ZstdCompress = exports.BrotliDecompress = exports.BrotliCompress = exports.Unzip = exports.InflateRaw = exports.DeflateRaw = exports.Gunzip = exports.Gzip = exports.Inflate = exports.Deflate = exports.Zlib = exports.ZlibError = exports.constants = void 0;
+const assert_1 = __importDefault(require("assert"));
+const buffer_1 = require("buffer");
+const minipass_1 = require("minipass");
+const realZlib = __importStar(require("zlib"));
+const constants_js_1 = require("./constants.js");
+var constants_js_2 = require("./constants.js");
+Object.defineProperty(exports, "constants", { enumerable: true, get: function () { return constants_js_2.constants; } });
+const OriginalBufferConcat = buffer_1.Buffer.concat;
+const desc = Object.getOwnPropertyDescriptor(buffer_1.Buffer, 'concat');
+const noop = (args) => args;
+const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
+ ? (makeNoOp) => {
+ buffer_1.Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
+ }
+ : (_) => { };
+const _superWrite = Symbol('_superWrite');
+class ZlibError extends Error {
+ code;
+ errno;
+ constructor(err, origin) {
+ super('zlib: ' + err.message, { cause: err });
+ this.code = err.code;
+ this.errno = err.errno;
+ /* c8 ignore next */
+ if (!this.code)
+ this.code = 'ZLIB_ERROR';
+ this.message = 'zlib: ' + err.message;
+ Error.captureStackTrace(this, origin ?? this.constructor);
+ }
+ get name() {
+ return 'ZlibError';
+ }
+}
+exports.ZlibError = ZlibError;
+// the Zlib class they all inherit from
+// This thing manages the queue of requests, and returns
+// true or false if there is anything in the queue when
+// you call the .write() method.
+const _flushFlag = Symbol('flushFlag');
+class ZlibBase extends minipass_1.Minipass {
+ #sawError = false;
+ #ended = false;
+ #flushFlag;
+ #finishFlushFlag;
+ #fullFlushFlag;
+ #handle;
+ #onError;
+ get sawError() {
+ return this.#sawError;
+ }
+ get handle() {
+ return this.#handle;
+ }
+ /* c8 ignore start */
+ get flushFlag() {
+ return this.#flushFlag;
+ }
+ /* c8 ignore stop */
+ constructor(opts, mode) {
+ if (!opts || typeof opts !== 'object')
+ throw new TypeError('invalid options for ZlibBase constructor');
+ //@ts-ignore
+ super(opts);
+ /* c8 ignore start */
+ this.#flushFlag = opts.flush ?? 0;
+ this.#finishFlushFlag = opts.finishFlush ?? 0;
+ this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
+ /* c8 ignore stop */
+ //@ts-ignore
+ if (typeof realZlib[mode] !== 'function') {
+ throw new TypeError('Compression method not supported: ' + mode);
+ }
+ // this will throw if any options are invalid for the class selected
+ try {
+ // @types/node doesn't know that it exports the classes, but they're there
+ //@ts-ignore
+ this.#handle = new realZlib[mode](opts);
+ }
+ catch (er) {
+ // make sure that all errors get decorated properly
+ throw new ZlibError(er, this.constructor);
+ }
+ this.#onError = err => {
+ // no sense raising multiple errors, since we abort on the first one.
+ if (this.#sawError)
+ return;
+ this.#sawError = true;
+ // there is no way to cleanly recover.
+ // continuing only obscures problems.
+ this.close();
+ this.emit('error', err);
+ };
+ this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
+ this.once('end', () => this.close);
+ }
+ close() {
+ if (this.#handle) {
+ this.#handle.close();
+ this.#handle = undefined;
+ this.emit('close');
+ }
+ }
+ reset() {
+ if (!this.#sawError) {
+ (0, assert_1.default)(this.#handle, 'zlib binding closed');
+ //@ts-ignore
+ return this.#handle.reset?.();
+ }
+ }
+ flush(flushFlag) {
+ if (this.ended)
+ return;
+ if (typeof flushFlag !== 'number')
+ flushFlag = this.#fullFlushFlag;
+ this.write(Object.assign(buffer_1.Buffer.alloc(0), { [_flushFlag]: flushFlag }));
+ }
+ end(chunk, encoding, cb) {
+ /* c8 ignore start */
+ if (typeof chunk === 'function') {
+ cb = chunk;
+ encoding = undefined;
+ chunk = undefined;
+ }
+ if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = undefined;
+ }
+ /* c8 ignore stop */
+ if (chunk) {
+ if (encoding)
+ this.write(chunk, encoding);
+ else
+ this.write(chunk);
+ }
+ this.flush(this.#finishFlushFlag);
+ this.#ended = true;
+ return super.end(cb);
+ }
+ get ended() {
+ return this.#ended;
+ }
+ // overridden in the gzip classes to do portable writes
+ [_superWrite](data) {
+ return super.write(data);
+ }
+ write(chunk, encoding, cb) {
+ // process the chunk using the sync process
+ // then super.write() all the outputted chunks
+ if (typeof encoding === 'function')
+ (cb = encoding), (encoding = 'utf8');
+ if (typeof chunk === 'string')
+ chunk = buffer_1.Buffer.from(chunk, encoding);
+ if (this.#sawError)
+ return;
+ (0, assert_1.default)(this.#handle, 'zlib binding closed');
+ // _processChunk tries to .close() the native handle after it's done, so we
+ // intercept that by temporarily making it a no-op.
+ // diving into the node:zlib internals a bit here
+ const nativeHandle = this.#handle
+ ._handle;
+ const originalNativeClose = nativeHandle.close;
+ nativeHandle.close = () => { };
+ const originalClose = this.#handle.close;
+ this.#handle.close = () => { };
+ // It also calls `Buffer.concat()` at the end, which may be convenient
+ // for some, but which we are not interested in as it slows us down.
+ passthroughBufferConcat(true);
+ let result = undefined;
+ try {
+ const flushFlag = typeof chunk[_flushFlag] === 'number'
+ ? chunk[_flushFlag]
+ : this.#flushFlag;
+ result = this.#handle._processChunk(chunk, flushFlag);
+ // if we don't throw, reset it back how it was
+ passthroughBufferConcat(false);
+ }
+ catch (err) {
+ // or if we do, put Buffer.concat() back before we emit error
+ // Error events call into user code, which may call Buffer.concat()
+ passthroughBufferConcat(false);
+ this.#onError(new ZlibError(err, this.write));
+ }
+ finally {
+ if (this.#handle) {
+ // Core zlib resets `_handle` to null after attempting to close the
+ // native handle. Our no-op handler prevented actual closure, but we
+ // need to restore the `._handle` property.
+ ;
+ this.#handle._handle =
+ nativeHandle;
+ nativeHandle.close = originalNativeClose;
+ this.#handle.close = originalClose;
+ // `_processChunk()` adds an 'error' listener. If we don't remove it
+ // after each call, these handlers start piling up.
+ this.#handle.removeAllListeners('error');
+ // make sure OUR error listener is still attached tho
+ }
+ }
+ if (this.#handle)
+ this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)));
+ let writeReturn;
+ if (result) {
+ if (Array.isArray(result) && result.length > 0) {
+ const r = result[0];
+ // The first buffer is always `handle._outBuffer`, which would be
+ // re-used for later invocations; so, we always have to copy that one.
+ writeReturn = this[_superWrite](buffer_1.Buffer.from(r));
+ for (let i = 1; i < result.length; i++) {
+ writeReturn = this[_superWrite](result[i]);
+ }
+ }
+ else {
+ // either a single Buffer or an empty array
+ writeReturn = this[_superWrite](buffer_1.Buffer.from(result));
+ }
+ }
+ if (cb)
+ cb();
+ return writeReturn;
+ }
+}
+class Zlib extends ZlibBase {
+ #level;
+ #strategy;
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants_js_1.constants.Z_NO_FLUSH;
+ opts.finishFlush = opts.finishFlush || constants_js_1.constants.Z_FINISH;
+ opts.fullFlushFlag = constants_js_1.constants.Z_FULL_FLUSH;
+ super(opts, mode);
+ this.#level = opts.level;
+ this.#strategy = opts.strategy;
+ }
+ params(level, strategy) {
+ if (this.sawError)
+ return;
+ if (!this.handle)
+ throw new Error('cannot switch params when binding is closed');
+ // no way to test this without also not supporting params at all
+ /* c8 ignore start */
+ if (!this.handle.params)
+ throw new Error('not supported in this implementation');
+ /* c8 ignore stop */
+ if (this.#level !== level || this.#strategy !== strategy) {
+ this.flush(constants_js_1.constants.Z_SYNC_FLUSH);
+ (0, assert_1.default)(this.handle, 'zlib binding closed');
+ // .params() calls .flush(), but the latter is always async in the
+ // core zlib. We override .flush() temporarily to intercept that and
+ // flush synchronously.
+ const origFlush = this.handle.flush;
+ this.handle.flush = (flushFlag, cb) => {
+ /* c8 ignore start */
+ if (typeof flushFlag === 'function') {
+ cb = flushFlag;
+ flushFlag = this.flushFlag;
+ }
+ /* c8 ignore stop */
+ this.flush(flushFlag);
+ cb?.();
+ };
+ try {
+ ;
+ this.handle.params(level, strategy);
+ }
+ finally {
+ this.handle.flush = origFlush;
+ }
+ /* c8 ignore start */
+ if (this.handle) {
+ this.#level = level;
+ this.#strategy = strategy;
+ }
+ /* c8 ignore stop */
+ }
+ }
+}
+exports.Zlib = Zlib;
+// minimal 2-byte header
+class Deflate extends Zlib {
+ constructor(opts) {
+ super(opts, 'Deflate');
+ }
+}
+exports.Deflate = Deflate;
+class Inflate extends Zlib {
+ constructor(opts) {
+ super(opts, 'Inflate');
+ }
+}
+exports.Inflate = Inflate;
+class Gzip extends Zlib {
+ #portable;
+ constructor(opts) {
+ super(opts, 'Gzip');
+ this.#portable = opts && !!opts.portable;
+ }
+ [_superWrite](data) {
+ if (!this.#portable)
+ return super[_superWrite](data);
+ // we'll always get the header emitted in one first chunk
+ // overwrite the OS indicator byte with 0xFF
+ this.#portable = false;
+ data[9] = 255;
+ return super[_superWrite](data);
+ }
+}
+exports.Gzip = Gzip;
+class Gunzip extends Zlib {
+ constructor(opts) {
+ super(opts, 'Gunzip');
+ }
+}
+exports.Gunzip = Gunzip;
+// raw - no header
+class DeflateRaw extends Zlib {
+ constructor(opts) {
+ super(opts, 'DeflateRaw');
+ }
+}
+exports.DeflateRaw = DeflateRaw;
+class InflateRaw extends Zlib {
+ constructor(opts) {
+ super(opts, 'InflateRaw');
+ }
+}
+exports.InflateRaw = InflateRaw;
+// auto-detect header.
+class Unzip extends Zlib {
+ constructor(opts) {
+ super(opts, 'Unzip');
+ }
+}
+exports.Unzip = Unzip;
+class Brotli extends ZlibBase {
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants_js_1.constants.BROTLI_OPERATION_PROCESS;
+ opts.finishFlush =
+ opts.finishFlush || constants_js_1.constants.BROTLI_OPERATION_FINISH;
+ opts.fullFlushFlag = constants_js_1.constants.BROTLI_OPERATION_FLUSH;
+ super(opts, mode);
+ }
+}
+class BrotliCompress extends Brotli {
+ constructor(opts) {
+ super(opts, 'BrotliCompress');
+ }
+}
+exports.BrotliCompress = BrotliCompress;
+class BrotliDecompress extends Brotli {
+ constructor(opts) {
+ super(opts, 'BrotliDecompress');
+ }
+}
+exports.BrotliDecompress = BrotliDecompress;
+class Zstd extends ZlibBase {
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants_js_1.constants.ZSTD_e_continue;
+ opts.finishFlush = opts.finishFlush || constants_js_1.constants.ZSTD_e_end;
+ opts.fullFlushFlag = constants_js_1.constants.ZSTD_e_flush;
+ super(opts, mode);
+ }
+}
+class ZstdCompress extends Zstd {
+ constructor(opts) {
+ super(opts, 'ZstdCompress');
+ }
+}
+exports.ZstdCompress = ZstdCompress;
+class ZstdDecompress extends Zstd {
+ constructor(opts) {
+ super(opts, 'ZstdDecompress');
+ }
+}
+exports.ZstdDecompress = ZstdDecompress;
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/commonjs/package.json b/node_modules/minizlib/dist/commonjs/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/node_modules/minizlib/dist/commonjs/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/node_modules/minizlib/dist/esm/constants.d.ts b/node_modules/minizlib/dist/esm/constants.d.ts
new file mode 100644
index 0000000..67c47b4
--- /dev/null
+++ b/node_modules/minizlib/dist/esm/constants.d.ts
@@ -0,0 +1,2 @@
+export declare const constants: any;
+//# sourceMappingURL=constants.d.ts.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/esm/constants.js b/node_modules/minizlib/dist/esm/constants.js
new file mode 100644
index 0000000..7faf40b
--- /dev/null
+++ b/node_modules/minizlib/dist/esm/constants.js
@@ -0,0 +1,117 @@
+// Update with any zlib constants that are added or changed in the future.
+// Node v6 didn't export this, so we just hard code the version and rely
+// on all the other hard-coded values from zlib v4736. When node v6
+// support drops, we can just export the realZlibConstants object.
+import realZlib from 'zlib';
+/* c8 ignore start */
+const realZlibConstants = realZlib.constants || { ZLIB_VERNUM: 4736 };
+/* c8 ignore stop */
+export const constants = Object.freeze(Object.assign(Object.create(null), {
+ Z_NO_FLUSH: 0,
+ Z_PARTIAL_FLUSH: 1,
+ Z_SYNC_FLUSH: 2,
+ Z_FULL_FLUSH: 3,
+ Z_FINISH: 4,
+ Z_BLOCK: 5,
+ Z_OK: 0,
+ Z_STREAM_END: 1,
+ Z_NEED_DICT: 2,
+ Z_ERRNO: -1,
+ Z_STREAM_ERROR: -2,
+ Z_DATA_ERROR: -3,
+ Z_MEM_ERROR: -4,
+ Z_BUF_ERROR: -5,
+ Z_VERSION_ERROR: -6,
+ Z_NO_COMPRESSION: 0,
+ Z_BEST_SPEED: 1,
+ Z_BEST_COMPRESSION: 9,
+ Z_DEFAULT_COMPRESSION: -1,
+ Z_FILTERED: 1,
+ Z_HUFFMAN_ONLY: 2,
+ Z_RLE: 3,
+ Z_FIXED: 4,
+ Z_DEFAULT_STRATEGY: 0,
+ DEFLATE: 1,
+ INFLATE: 2,
+ GZIP: 3,
+ GUNZIP: 4,
+ DEFLATERAW: 5,
+ INFLATERAW: 6,
+ UNZIP: 7,
+ BROTLI_DECODE: 8,
+ BROTLI_ENCODE: 9,
+ Z_MIN_WINDOWBITS: 8,
+ Z_MAX_WINDOWBITS: 15,
+ Z_DEFAULT_WINDOWBITS: 15,
+ Z_MIN_CHUNK: 64,
+ Z_MAX_CHUNK: Infinity,
+ Z_DEFAULT_CHUNK: 16384,
+ Z_MIN_MEMLEVEL: 1,
+ Z_MAX_MEMLEVEL: 9,
+ Z_DEFAULT_MEMLEVEL: 8,
+ Z_MIN_LEVEL: -1,
+ Z_MAX_LEVEL: 9,
+ Z_DEFAULT_LEVEL: -1,
+ BROTLI_OPERATION_PROCESS: 0,
+ BROTLI_OPERATION_FLUSH: 1,
+ BROTLI_OPERATION_FINISH: 2,
+ BROTLI_OPERATION_EMIT_METADATA: 3,
+ BROTLI_MODE_GENERIC: 0,
+ BROTLI_MODE_TEXT: 1,
+ BROTLI_MODE_FONT: 2,
+ BROTLI_DEFAULT_MODE: 0,
+ BROTLI_MIN_QUALITY: 0,
+ BROTLI_MAX_QUALITY: 11,
+ BROTLI_DEFAULT_QUALITY: 11,
+ BROTLI_MIN_WINDOW_BITS: 10,
+ BROTLI_MAX_WINDOW_BITS: 24,
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
+ BROTLI_DEFAULT_WINDOW: 22,
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
+ BROTLI_PARAM_MODE: 0,
+ BROTLI_PARAM_QUALITY: 1,
+ BROTLI_PARAM_LGWIN: 2,
+ BROTLI_PARAM_LGBLOCK: 3,
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
+ BROTLI_PARAM_SIZE_HINT: 5,
+ BROTLI_PARAM_LARGE_WINDOW: 6,
+ BROTLI_PARAM_NPOSTFIX: 7,
+ BROTLI_PARAM_NDIRECT: 8,
+ BROTLI_DECODER_RESULT_ERROR: 0,
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
+ BROTLI_DECODER_NO_ERROR: 0,
+ BROTLI_DECODER_SUCCESS: 1,
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31,
+}, realZlibConstants));
+//# sourceMappingURL=constants.js.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/esm/index.d.ts b/node_modules/minizlib/dist/esm/index.d.ts
new file mode 100644
index 0000000..8044bd0
--- /dev/null
+++ b/node_modules/minizlib/dist/esm/index.d.ts
@@ -0,0 +1,99 @@
+import { Buffer } from 'buffer';
+import { Minipass } from 'minipass';
+import * as realZlib from 'zlib';
+export { constants } from './constants.js';
+declare const _superWrite: unique symbol;
+export declare class ZlibError extends Error {
+ code?: string;
+ errno?: number;
+ constructor(err: NodeJS.ErrnoException | Error, origin?: Function);
+ get name(): string;
+}
+declare const _flushFlag: unique symbol;
+export type ChunkWithFlushFlag = Minipass.ContiguousData & {
+ [_flushFlag]?: number;
+};
+export type ZlibBaseOptions = Minipass.Options<Minipass.ContiguousData> & {
+ flush?: number;
+ finishFlush?: number;
+ fullFlushFlag?: number;
+};
+export type ZlibHandle = realZlib.Gzip | realZlib.Gunzip | realZlib.Deflate | realZlib.Inflate | realZlib.DeflateRaw | realZlib.InflateRaw | realZlib.BrotliCompress | realZlib.BrotliDecompress | realZlib.ZstdCompress | realZlib.ZstdDecompress;
+export type ZlibMode = 'Gzip' | 'Gunzip' | 'Deflate' | 'Inflate' | 'DeflateRaw' | 'InflateRaw' | 'Unzip';
+export type BrotliMode = 'BrotliCompress' | 'BrotliDecompress';
+export type ZstdMode = 'ZstdCompress' | 'ZstdDecompress';
+declare abstract class ZlibBase extends Minipass<Buffer, ChunkWithFlushFlag> {
+ #private;
+ get sawError(): boolean;
+ get handle(): ZlibHandle | undefined;
+ get flushFlag(): number;
+ constructor(opts: ZlibBaseOptions, mode: ZlibMode | BrotliMode | ZstdMode);
+ close(): void;
+ reset(): any;
+ flush(flushFlag?: number): void;
+ end(cb?: () => void): this;
+ end(chunk: ChunkWithFlushFlag, cb?: () => void): this;
+ end(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): this;
+ get ended(): boolean;
+ [_superWrite](data: Buffer & {
+ [_flushFlag]?: number;
+ }): boolean;
+ write(chunk: ChunkWithFlushFlag, cb?: () => void): boolean;
+ write(chunk: ChunkWithFlushFlag, encoding?: Minipass.Encoding, cb?: () => void): boolean;
+}
+export type ZlibOptions = ZlibBaseOptions & {
+ level?: number;
+ strategy?: number;
+};
+export declare class Zlib extends ZlibBase {
+ #private;
+ constructor(opts: ZlibOptions, mode: ZlibMode);
+ params(level: number, strategy: number): void;
+}
+export declare class Deflate extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class Inflate extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export type GzipOptions = ZlibOptions & {
+ portable?: boolean;
+};
+export declare class Gzip extends Zlib {
+ #private;
+ constructor(opts: GzipOptions);
+ [_superWrite](data: Buffer & {
+ [_flushFlag]?: number;
+ }): boolean;
+}
+export declare class Gunzip extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class DeflateRaw extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class InflateRaw extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+export declare class Unzip extends Zlib {
+ constructor(opts: ZlibOptions);
+}
+declare class Brotli extends ZlibBase {
+ constructor(opts: ZlibOptions, mode: BrotliMode);
+}
+export declare class BrotliCompress extends Brotli {
+ constructor(opts: ZlibOptions);
+}
+export declare class BrotliDecompress extends Brotli {
+ constructor(opts: ZlibOptions);
+}
+declare class Zstd extends ZlibBase {
+ constructor(opts: ZlibOptions, mode: ZstdMode);
+}
+export declare class ZstdCompress extends Zstd {
+ constructor(opts: ZlibOptions);
+}
+export declare class ZstdDecompress extends Zstd {
+ constructor(opts: ZlibOptions);
+}
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/esm/index.js b/node_modules/minizlib/dist/esm/index.js
new file mode 100644
index 0000000..b70ba1f
--- /dev/null
+++ b/node_modules/minizlib/dist/esm/index.js
@@ -0,0 +1,363 @@
+import assert from 'assert';
+import { Buffer } from 'buffer';
+import { Minipass } from 'minipass';
+import * as realZlib from 'zlib';
+import { constants } from './constants.js';
+export { constants } from './constants.js';
+const OriginalBufferConcat = Buffer.concat;
+const desc = Object.getOwnPropertyDescriptor(Buffer, 'concat');
+const noop = (args) => args;
+const passthroughBufferConcat = desc?.writable === true || desc?.set !== undefined
+ ? (makeNoOp) => {
+ Buffer.concat = makeNoOp ? noop : OriginalBufferConcat;
+ }
+ : (_) => { };
+const _superWrite = Symbol('_superWrite');
+export class ZlibError extends Error {
+ code;
+ errno;
+ constructor(err, origin) {
+ super('zlib: ' + err.message, { cause: err });
+ this.code = err.code;
+ this.errno = err.errno;
+ /* c8 ignore next */
+ if (!this.code)
+ this.code = 'ZLIB_ERROR';
+ this.message = 'zlib: ' + err.message;
+ Error.captureStackTrace(this, origin ?? this.constructor);
+ }
+ get name() {
+ return 'ZlibError';
+ }
+}
+// the Zlib class they all inherit from
+// This thing manages the queue of requests, and returns
+// true or false if there is anything in the queue when
+// you call the .write() method.
+const _flushFlag = Symbol('flushFlag');
+class ZlibBase extends Minipass {
+ #sawError = false;
+ #ended = false;
+ #flushFlag;
+ #finishFlushFlag;
+ #fullFlushFlag;
+ #handle;
+ #onError;
+ get sawError() {
+ return this.#sawError;
+ }
+ get handle() {
+ return this.#handle;
+ }
+ /* c8 ignore start */
+ get flushFlag() {
+ return this.#flushFlag;
+ }
+ /* c8 ignore stop */
+ constructor(opts, mode) {
+ if (!opts || typeof opts !== 'object')
+ throw new TypeError('invalid options for ZlibBase constructor');
+ //@ts-ignore
+ super(opts);
+ /* c8 ignore start */
+ this.#flushFlag = opts.flush ?? 0;
+ this.#finishFlushFlag = opts.finishFlush ?? 0;
+ this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
+ /* c8 ignore stop */
+ //@ts-ignore
+ if (typeof realZlib[mode] !== 'function') {
+ throw new TypeError('Compression method not supported: ' + mode);
+ }
+ // this will throw if any options are invalid for the class selected
+ try {
+ // @types/node doesn't know that it exports the classes, but they're there
+ //@ts-ignore
+ this.#handle = new realZlib[mode](opts);
+ }
+ catch (er) {
+ // make sure that all errors get decorated properly
+ throw new ZlibError(er, this.constructor);
+ }
+ this.#onError = err => {
+ // no sense raising multiple errors, since we abort on the first one.
+ if (this.#sawError)
+ return;
+ this.#sawError = true;
+ // there is no way to cleanly recover.
+ // continuing only obscures problems.
+ this.close();
+ this.emit('error', err);
+ };
+ this.#handle?.on('error', er => this.#onError(new ZlibError(er)));
+ this.once('end', () => this.close);
+ }
+ close() {
+ if (this.#handle) {
+ this.#handle.close();
+ this.#handle = undefined;
+ this.emit('close');
+ }
+ }
+ reset() {
+ if (!this.#sawError) {
+ assert(this.#handle, 'zlib binding closed');
+ //@ts-ignore
+ return this.#handle.reset?.();
+ }
+ }
+ flush(flushFlag) {
+ if (this.ended)
+ return;
+ if (typeof flushFlag !== 'number')
+ flushFlag = this.#fullFlushFlag;
+ this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }));
+ }
+ end(chunk, encoding, cb) {
+ /* c8 ignore start */
+ if (typeof chunk === 'function') {
+ cb = chunk;
+ encoding = undefined;
+ chunk = undefined;
+ }
+ if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = undefined;
+ }
+ /* c8 ignore stop */
+ if (chunk) {
+ if (encoding)
+ this.write(chunk, encoding);
+ else
+ this.write(chunk);
+ }
+ this.flush(this.#finishFlushFlag);
+ this.#ended = true;
+ return super.end(cb);
+ }
+ get ended() {
+ return this.#ended;
+ }
+ // overridden in the gzip classes to do portable writes
+ [_superWrite](data) {
+ return super.write(data);
+ }
+ write(chunk, encoding, cb) {
+ // process the chunk using the sync process
+ // then super.write() all the outputted chunks
+ if (typeof encoding === 'function')
+ (cb = encoding), (encoding = 'utf8');
+ if (typeof chunk === 'string')
+ chunk = Buffer.from(chunk, encoding);
+ if (this.#sawError)
+ return;
+ assert(this.#handle, 'zlib binding closed');
+ // _processChunk tries to .close() the native handle after it's done, so we
+ // intercept that by temporarily making it a no-op.
+ // diving into the node:zlib internals a bit here
+ const nativeHandle = this.#handle
+ ._handle;
+ const originalNativeClose = nativeHandle.close;
+ nativeHandle.close = () => { };
+ const originalClose = this.#handle.close;
+ this.#handle.close = () => { };
+ // It also calls `Buffer.concat()` at the end, which may be convenient
+ // for some, but which we are not interested in as it slows us down.
+ passthroughBufferConcat(true);
+ let result = undefined;
+ try {
+ const flushFlag = typeof chunk[_flushFlag] === 'number'
+ ? chunk[_flushFlag]
+ : this.#flushFlag;
+ result = this.#handle._processChunk(chunk, flushFlag);
+ // if we don't throw, reset it back how it was
+ passthroughBufferConcat(false);
+ }
+ catch (err) {
+ // or if we do, put Buffer.concat() back before we emit error
+ // Error events call into user code, which may call Buffer.concat()
+ passthroughBufferConcat(false);
+ this.#onError(new ZlibError(err, this.write));
+ }
+ finally {
+ if (this.#handle) {
+ // Core zlib resets `_handle` to null after attempting to close the
+ // native handle. Our no-op handler prevented actual closure, but we
+ // need to restore the `._handle` property.
+ ;
+ this.#handle._handle =
+ nativeHandle;
+ nativeHandle.close = originalNativeClose;
+ this.#handle.close = originalClose;
+ // `_processChunk()` adds an 'error' listener. If we don't remove it
+ // after each call, these handlers start piling up.
+ this.#handle.removeAllListeners('error');
+ // make sure OUR error listener is still attached tho
+ }
+ }
+ if (this.#handle)
+ this.#handle.on('error', er => this.#onError(new ZlibError(er, this.write)));
+ let writeReturn;
+ if (result) {
+ if (Array.isArray(result) && result.length > 0) {
+ const r = result[0];
+ // The first buffer is always `handle._outBuffer`, which would be
+ // re-used for later invocations; so, we always have to copy that one.
+ writeReturn = this[_superWrite](Buffer.from(r));
+ for (let i = 1; i < result.length; i++) {
+ writeReturn = this[_superWrite](result[i]);
+ }
+ }
+ else {
+ // either a single Buffer or an empty array
+ writeReturn = this[_superWrite](Buffer.from(result));
+ }
+ }
+ if (cb)
+ cb();
+ return writeReturn;
+ }
+}
+export class Zlib extends ZlibBase {
+ #level;
+ #strategy;
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants.Z_NO_FLUSH;
+ opts.finishFlush = opts.finishFlush || constants.Z_FINISH;
+ opts.fullFlushFlag = constants.Z_FULL_FLUSH;
+ super(opts, mode);
+ this.#level = opts.level;
+ this.#strategy = opts.strategy;
+ }
+ params(level, strategy) {
+ if (this.sawError)
+ return;
+ if (!this.handle)
+ throw new Error('cannot switch params when binding is closed');
+ // no way to test this without also not supporting params at all
+ /* c8 ignore start */
+ if (!this.handle.params)
+ throw new Error('not supported in this implementation');
+ /* c8 ignore stop */
+ if (this.#level !== level || this.#strategy !== strategy) {
+ this.flush(constants.Z_SYNC_FLUSH);
+ assert(this.handle, 'zlib binding closed');
+ // .params() calls .flush(), but the latter is always async in the
+ // core zlib. We override .flush() temporarily to intercept that and
+ // flush synchronously.
+ const origFlush = this.handle.flush;
+ this.handle.flush = (flushFlag, cb) => {
+ /* c8 ignore start */
+ if (typeof flushFlag === 'function') {
+ cb = flushFlag;
+ flushFlag = this.flushFlag;
+ }
+ /* c8 ignore stop */
+ this.flush(flushFlag);
+ cb?.();
+ };
+ try {
+ ;
+ this.handle.params(level, strategy);
+ }
+ finally {
+ this.handle.flush = origFlush;
+ }
+ /* c8 ignore start */
+ if (this.handle) {
+ this.#level = level;
+ this.#strategy = strategy;
+ }
+ /* c8 ignore stop */
+ }
+ }
+}
+// minimal 2-byte header
+export class Deflate extends Zlib {
+ constructor(opts) {
+ super(opts, 'Deflate');
+ }
+}
+export class Inflate extends Zlib {
+ constructor(opts) {
+ super(opts, 'Inflate');
+ }
+}
+export class Gzip extends Zlib {
+ #portable;
+ constructor(opts) {
+ super(opts, 'Gzip');
+ this.#portable = opts && !!opts.portable;
+ }
+ [_superWrite](data) {
+ if (!this.#portable)
+ return super[_superWrite](data);
+ // we'll always get the header emitted in one first chunk
+ // overwrite the OS indicator byte with 0xFF
+ this.#portable = false;
+ data[9] = 255;
+ return super[_superWrite](data);
+ }
+}
+export class Gunzip extends Zlib {
+ constructor(opts) {
+ super(opts, 'Gunzip');
+ }
+}
+// raw - no header
+export class DeflateRaw extends Zlib {
+ constructor(opts) {
+ super(opts, 'DeflateRaw');
+ }
+}
+export class InflateRaw extends Zlib {
+ constructor(opts) {
+ super(opts, 'InflateRaw');
+ }
+}
+// auto-detect header.
+export class Unzip extends Zlib {
+ constructor(opts) {
+ super(opts, 'Unzip');
+ }
+}
+class Brotli extends ZlibBase {
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS;
+ opts.finishFlush =
+ opts.finishFlush || constants.BROTLI_OPERATION_FINISH;
+ opts.fullFlushFlag = constants.BROTLI_OPERATION_FLUSH;
+ super(opts, mode);
+ }
+}
+export class BrotliCompress extends Brotli {
+ constructor(opts) {
+ super(opts, 'BrotliCompress');
+ }
+}
+export class BrotliDecompress extends Brotli {
+ constructor(opts) {
+ super(opts, 'BrotliDecompress');
+ }
+}
+class Zstd extends ZlibBase {
+ constructor(opts, mode) {
+ opts = opts || {};
+ opts.flush = opts.flush || constants.ZSTD_e_continue;
+ opts.finishFlush = opts.finishFlush || constants.ZSTD_e_end;
+ opts.fullFlushFlag = constants.ZSTD_e_flush;
+ super(opts, mode);
+ }
+}
+export class ZstdCompress extends Zstd {
+ constructor(opts) {
+ super(opts, 'ZstdCompress');
+ }
+}
+export class ZstdDecompress extends Zstd {
+ constructor(opts) {
+ super(opts, 'ZstdDecompress');
+ }
+}
+//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/node_modules/minizlib/dist/esm/package.json b/node_modules/minizlib/dist/esm/package.json
new file mode 100644
index 0000000..3dbc1ca
--- /dev/null
+++ b/node_modules/minizlib/dist/esm/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "module"
+}
diff --git a/node_modules/minizlib/package.json b/node_modules/minizlib/package.json
new file mode 100644
index 0000000..dceaed9
--- /dev/null
+++ b/node_modules/minizlib/package.json
@@ -0,0 +1,80 @@
+{
+ "name": "minizlib",
+ "version": "3.1.0",
+ "description": "A small fast zlib stream built on [minipass](http://npm.im/minipass) and Node.js's zlib binding.",
+ "main": "./dist/commonjs/index.js",
+ "dependencies": {
+ "minipass": "^7.1.2"
+ },
+ "scripts": {
+ "prepare": "tshy",
+ "pretest": "npm run prepare",
+ "test": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "format": "prettier --write . --loglevel warn",
+ "typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/isaacs/minizlib.git"
+ },
+ "keywords": [
+ "zlib",
+ "gzip",
+ "gunzip",
+ "deflate",
+ "inflate",
+ "compression",
+ "zip",
+ "unzip"
+ ],
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "license": "MIT",
+ "devDependencies": {
+ "@types/node": "^24.5.2",
+ "tap": "^21.1.0",
+ "tshy": "^3.0.2",
+ "typedoc": "^0.28.1"
+ },
+ "files": [
+ "dist"
+ ],
+ "engines": {
+ "node": ">= 18"
+ },
+ "tshy": {
+ "exports": {
+ "./package.json": "./package.json",
+ ".": "./src/index.ts"
+ }
+ },
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "import": {
+ "types": "./dist/esm/index.d.ts",
+ "default": "./dist/esm/index.js"
+ },
+ "require": {
+ "types": "./dist/commonjs/index.d.ts",
+ "default": "./dist/commonjs/index.js"
+ }
+ }
+ },
+ "types": "./dist/commonjs/index.d.ts",
+ "type": "module",
+ "prettier": {
+ "semi": false,
+ "printWidth": 75,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": false,
+ "bracketSameLine": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+ },
+ "module": "./dist/esm/index.js"
+}