node-pkware 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +42 -40
  2. package/dist/ExpandingBuffer.d.ts +53 -0
  3. package/dist/ExpandingBuffer.js +134 -0
  4. package/dist/ExpandingBuffer.js.map +1 -0
  5. package/dist/Explode.d.ts +8 -0
  6. package/dist/Explode.js +309 -0
  7. package/dist/Explode.js.map +1 -0
  8. package/dist/Implode.d.ts +11 -0
  9. package/dist/Implode.js +305 -0
  10. package/dist/Implode.js.map +1 -0
  11. package/dist/bin/explode.d.ts +2 -0
  12. package/dist/bin/explode.js +59 -0
  13. package/dist/bin/explode.js.map +1 -0
  14. package/dist/bin/helpers.d.ts +8 -0
  15. package/dist/bin/helpers.js +65 -0
  16. package/dist/bin/helpers.js.map +1 -0
  17. package/dist/bin/implode.d.ts +2 -0
  18. package/dist/bin/implode.js +79 -0
  19. package/dist/bin/implode.js.map +1 -0
  20. package/dist/constants.d.ts +32 -0
  21. package/dist/constants.js +114 -0
  22. package/dist/constants.js.map +1 -0
  23. package/{types → dist}/errors.d.ts +13 -11
  24. package/dist/errors.js +52 -0
  25. package/dist/errors.js.map +1 -0
  26. package/dist/functions.d.ts +11 -0
  27. package/dist/functions.js +73 -0
  28. package/dist/functions.js.map +1 -0
  29. package/dist/index.d.ts +20 -0
  30. package/dist/index.js +54 -0
  31. package/dist/index.js.map +1 -0
  32. package/{types/helpers → dist}/stream.d.ts +13 -34
  33. package/dist/stream.js +205 -0
  34. package/dist/stream.js.map +1 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -0
  36. package/dist/types.d.ts +25 -0
  37. package/dist/types.js +3 -0
  38. package/dist/types.js.map +1 -0
  39. package/package.json +14 -45
  40. package/src/ExpandingBuffer.ts +148 -0
  41. package/src/Explode.ts +404 -0
  42. package/src/Implode.ts +368 -0
  43. package/{bin/explode.js → src/bin/explode.ts} +35 -33
  44. package/src/bin/helpers.ts +65 -0
  45. package/src/bin/implode.ts +116 -0
  46. package/src/{constants.js → constants.ts} +31 -50
  47. package/src/errors.ts +47 -0
  48. package/src/functions.ts +73 -0
  49. package/src/index.ts +30 -0
  50. package/src/stream.ts +220 -0
  51. package/src/types.ts +26 -0
  52. package/bin/implode.js +0 -116
  53. package/src/errors.js +0 -50
  54. package/src/explode.js +0 -411
  55. package/src/helpers/ExpandingBuffer.js +0 -123
  56. package/src/helpers/functions.js +0 -150
  57. package/src/helpers/stream.js +0 -190
  58. package/src/helpers/testing.js +0 -80
  59. package/src/implode.js +0 -364
  60. package/src/index.js +0 -18
  61. package/tsconfig.json +0 -20
  62. package/types/constants.d.ts +0 -41
  63. package/types/explode.d.ts +0 -56
  64. package/types/helpers/ExpandingBuffer.d.ts +0 -25
  65. package/types/helpers/Shared.d.ts +0 -46
  66. package/types/helpers/functions.d.ts +0 -15
  67. package/types/helpers/testing.d.ts +0 -6
  68. package/types/implode.d.ts +0 -63
  69. package/types/index.d.ts +0 -8
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env -S node --enable-source-maps
2
+ export {};
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env -S node --enable-source-maps
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const minimist_lite_1 = __importDefault(require("minimist-lite"));
8
+ const helpers_1 = require("./helpers");
9
+ const stream_1 = require("../stream");
10
+ const index_1 = require("../index");
11
+ const args = (0, minimist_lite_1.default)(process.argv.slice(2), {
12
+ string: ['output', 'offset', 'input-buffer-size', 'output-buffer-size'],
13
+ boolean: ['version', 'drop-before-offset', 'verbose'],
14
+ alias: {
15
+ v: 'version',
16
+ },
17
+ });
18
+ const decompress = (input, output, offset, keepHeader, config) => {
19
+ const leftHandler = keepHeader ? (0, stream_1.transformIdentity)() : (0, stream_1.transformEmpty)();
20
+ const rightHandler = (0, index_1.explode)(config);
21
+ const handler = (0, stream_1.transformSplitBy)((0, stream_1.splitAt)(offset), leftHandler, rightHandler);
22
+ return new Promise((resolve, reject) => {
23
+ input.pipe((0, stream_1.through)(handler).on('error', reject)).pipe(output).on('finish', resolve).on('error', reject);
24
+ });
25
+ };
26
+ (async () => {
27
+ if (args.version) {
28
+ const version = await (0, helpers_1.getPackageVersion)();
29
+ console.log(`node-pkware - version ${version}`);
30
+ process.exit(0);
31
+ }
32
+ let input;
33
+ let output;
34
+ try {
35
+ input = await (0, helpers_1.getInputStream)(args._[0]);
36
+ output = await (0, helpers_1.getOutputStream)(args.output);
37
+ }
38
+ catch (e) {
39
+ const error = e;
40
+ console.error('error:', error.message);
41
+ process.exit(1);
42
+ }
43
+ const offset = (0, helpers_1.parseNumberString)(args.offset, 0);
44
+ const keepHeader = !args['drop-before-offset'];
45
+ const config = {
46
+ verbose: args.verbose,
47
+ inputBufferSize: (0, helpers_1.parseNumberString)(args['input-buffer-size'], 0x10000),
48
+ outputBufferSize: (0, helpers_1.parseNumberString)(args['output-buffer-size'], 0x40000),
49
+ };
50
+ decompress(input, output, offset, keepHeader, config)
51
+ .then(() => {
52
+ process.exit(0);
53
+ })
54
+ .catch((e) => {
55
+ console.error(`error: ${e.message}`);
56
+ process.exit(1);
57
+ });
58
+ })();
59
+ //# sourceMappingURL=explode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"explode.js","sourceRoot":"","sources":["../../src/bin/explode.ts"],"names":[],"mappings":";;;;;;AAEA,kEAAoC;AACpC,uCAAiG;AACjG,sCAAiG;AAEjG,oCAAkC;AAclC,MAAM,IAAI,GAAY,IAAA,uBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACpD,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,oBAAoB,CAAC;IACvE,OAAO,EAAE,CAAC,SAAS,EAAE,oBAAoB,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,EAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KAC5C;IAAC,OAAO,CAAU,EAAE;QACnB,MAAM,KAAK,GAAG,CAAU,CAAA;QACxB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,MAAM,MAAM,GAAG,IAAA,2BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IAC9C,MAAM,MAAM,GAAW;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,eAAe,EAAE,IAAA,2BAAiB,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;QACtE,gBAAgB,EAAE,IAAA,2BAAiB,EAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;KACzE,CAAA;IAED,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC;SAClD,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,EAAE,CAAA"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ export declare const parseNumberString: (n?: string, defaultValue?: number) => number;
6
+ export declare const getPackageVersion: () => Promise<string>;
7
+ export declare const getInputStream: (filename?: string) => Promise<NodeJS.ReadableStream>;
8
+ export declare const getOutputStream: (filename?: string) => Promise<NodeJS.WritableStream>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getOutputStream = exports.getInputStream = exports.getPackageVersion = exports.parseNumberString = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const isDecimalString = (input) => {
10
+ return /^\d+$/.test(input);
11
+ };
12
+ const isFullHexString = (input) => {
13
+ return /^\s*0x[0-9a-f]+\s*$/.test(input);
14
+ };
15
+ const parseNumberString = (n, defaultValue = 0) => {
16
+ if (typeof n === 'undefined') {
17
+ return defaultValue;
18
+ }
19
+ if (isDecimalString(n)) {
20
+ return parseInt(n);
21
+ }
22
+ if (isFullHexString(n)) {
23
+ return parseInt(n.replace(/^0x/, ''), 16);
24
+ }
25
+ return defaultValue;
26
+ };
27
+ exports.parseNumberString = parseNumberString;
28
+ const getPackageVersion = async () => {
29
+ try {
30
+ const rawIn = await node_fs_1.default.promises.readFile(node_path_1.default.resolve(__dirname, '../../package.json'), 'utf-8');
31
+ const { version } = JSON.parse(rawIn);
32
+ return version;
33
+ }
34
+ catch (error) {
35
+ return 'unknown';
36
+ }
37
+ };
38
+ exports.getPackageVersion = getPackageVersion;
39
+ const fileExists = async (filename) => {
40
+ try {
41
+ await node_fs_1.default.promises.access(filename, node_fs_1.default.constants.R_OK);
42
+ return true;
43
+ }
44
+ catch (error) {
45
+ return false;
46
+ }
47
+ };
48
+ const getInputStream = async (filename) => {
49
+ if (typeof filename === 'undefined') {
50
+ return process.openStdin();
51
+ }
52
+ if (await fileExists(filename)) {
53
+ return node_fs_1.default.createReadStream(filename);
54
+ }
55
+ throw new Error('input file does not exist');
56
+ };
57
+ exports.getInputStream = getInputStream;
58
+ const getOutputStream = async (filename) => {
59
+ if (typeof filename === 'undefined') {
60
+ return process.stdout;
61
+ }
62
+ return node_fs_1.default.createWriteStream(filename);
63
+ };
64
+ exports.getOutputStream = getOutputStream;
65
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/bin/helpers.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwB;AACxB,0DAA4B;AAE5B,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC1C,CAAC,CAAA;AAEM,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,eAAuB,CAAC,EAAE,EAAE;IACxE,IAAI,OAAO,CAAC,KAAK,WAAW,EAAE;QAC5B,OAAO,YAAY,CAAA;KACpB;IAED,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE;QACtB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAA;KACnB;IAED,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE;QACtB,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;KAC1C;IAED,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAdY,QAAA,iBAAiB,qBAc7B;AAEM,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;IAC1C,IAAI;QACF,MAAM,KAAK,GAAG,MAAM,iBAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAA;QAChG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAwB,CAAA;QAC5D,OAAO,OAAO,CAAA;KACf;IAAC,OAAO,KAAc,EAAE;QACvB,OAAO,SAAS,CAAA;KACjB;AACH,CAAC,CAAA;AARY,QAAA,iBAAiB,qBAQ7B;AAED,MAAM,UAAU,GAAG,KAAK,EAAE,QAAgB,EAAE,EAAE;IAC5C,IAAI;QACF,MAAM,iBAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACrD,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,KAAc,EAAE;QACvB,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AAEM,MAAM,cAAc,GAAG,KAAK,EAAE,QAAiB,EAAkC,EAAE;IACxF,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnC,OAAO,OAAO,CAAC,SAAS,EAAE,CAAA;KAC3B;IAED,IAAI,MAAM,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC9B,OAAO,iBAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;KACrC;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;AAC9C,CAAC,CAAA;AAVY,QAAA,cAAc,kBAU1B;AAEM,MAAM,eAAe,GAAG,KAAK,EAAE,QAAiB,EAAkC,EAAE;IACzF,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnC,OAAO,OAAO,CAAC,MAAM,CAAA;KACtB;IAED,OAAO,iBAAE,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env -S node --enable-source-maps
2
+ export {};
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env -S node --enable-source-maps
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const minimist_lite_1 = __importDefault(require("minimist-lite"));
8
+ const constants_1 = require("../constants");
9
+ const helpers_1 = require("./helpers");
10
+ const stream_1 = require("../stream");
11
+ const index_1 = require("../index");
12
+ const args = (0, minimist_lite_1.default)(process.argv.slice(2), {
13
+ string: ['output', 'offset', 'input-buffer-size', 'output-buffer-size'],
14
+ boolean: ['version', 'ascii', 'binary', 'small', 'medium', 'large', 'drop-before-offset', 'verbose'],
15
+ alias: {
16
+ v: 'version',
17
+ a: 'ascii',
18
+ b: 'binary',
19
+ s: 'small',
20
+ m: 'medium',
21
+ l: 'large',
22
+ },
23
+ });
24
+ const compress = (input, output, offset, keepHeader, compressionType, dictionarySize, config) => {
25
+ const leftHandler = keepHeader ? (0, stream_1.transformIdentity)() : (0, stream_1.transformEmpty)();
26
+ const rightHandler = (0, index_1.implode)(compressionType, dictionarySize, config);
27
+ const handler = (0, stream_1.transformSplitBy)((0, stream_1.splitAt)(offset), leftHandler, rightHandler);
28
+ return new Promise((resolve, reject) => {
29
+ input.pipe((0, stream_1.through)(handler).on('error', reject)).pipe(output).on('finish', resolve).on('error', reject);
30
+ });
31
+ };
32
+ (async () => {
33
+ if (args.version) {
34
+ const version = await (0, helpers_1.getPackageVersion)();
35
+ console.log(`node-pkware - version ${version}`);
36
+ process.exit(0);
37
+ }
38
+ let input;
39
+ let output;
40
+ try {
41
+ if (!args.ascii && !args.binary) {
42
+ throw new Error('compression type missing, expected either --ascii or --binary');
43
+ }
44
+ if (args.ascii && args.binary) {
45
+ throw new Error('multiple compression types specified, can only work with either --ascii or --binary');
46
+ }
47
+ if (!args.small && !args.medium && !args.large) {
48
+ throw new Error('dictionary size missing, expected either --small, --medium or --large');
49
+ }
50
+ if ((args.small ? 1 : 0) + (args.medium ? 1 : 0) + (args.large ? 1 : 0) > 1) {
51
+ throw new Error('multiple dictionary sizes specified, can only work with either --small, --medium or --large');
52
+ }
53
+ input = await (0, helpers_1.getInputStream)(args._[0]);
54
+ output = await (0, helpers_1.getOutputStream)(args.output);
55
+ }
56
+ catch (e) {
57
+ const error = e;
58
+ console.error('error:', error.message);
59
+ process.exit(1);
60
+ }
61
+ const compressionType = args.ascii ? constants_1.Compression.Ascii : constants_1.Compression.Binary;
62
+ const dictionarySize = args.small ? constants_1.DictionarySize.Small : args.medium ? constants_1.DictionarySize.Medium : constants_1.DictionarySize.Large;
63
+ const offset = (0, helpers_1.parseNumberString)(args.offset, 0);
64
+ const keepHeader = !args['drop-before-offset'];
65
+ const config = {
66
+ verbose: args.verbose,
67
+ inputBufferSize: (0, helpers_1.parseNumberString)(args['input-buffer-size'], 0x10000),
68
+ outputBufferSize: (0, helpers_1.parseNumberString)(args['output-buffer-size'], 0x12000),
69
+ };
70
+ compress(input, output, offset, keepHeader, compressionType, dictionarySize, config)
71
+ .then(() => {
72
+ process.exit(0);
73
+ })
74
+ .catch((e) => {
75
+ console.error(`error: ${e.message}`);
76
+ process.exit(1);
77
+ });
78
+ })();
79
+ //# sourceMappingURL=implode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"implode.js","sourceRoot":"","sources":["../../src/bin/implode.ts"],"names":[],"mappings":";;;;;;AAEA,kEAAoC;AACpC,4CAA0D;AAC1D,uCAAiG;AACjG,sCAAiG;AAEjG,oCAAkC;AAwBlC,MAAM,IAAI,GAAY,IAAA,uBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACpD,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,oBAAoB,CAAC;IACvE,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,SAAS,CAAC;IACpG,KAAK,EAAE;QACL,CAAC,EAAE,SAAS;QACZ,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,QAAQ;QACX,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,QAAQ;QACX,CAAC,E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BAAc,CAAC,MAAM,CAAC,CAAC,CAAC,0BAAc,CAAC,KAAK,CAAA;IACrH,MAAM,MAAM,GAAG,IAAA,2BAAiB,EAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;IAC9C,MAAM,MAAM,GAAW;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,eAAe,EAAE,IAAA,2BAAiB,EAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;QACtE,gBAAgB,EAAE,IAAA,2BAAiB,EAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;KACzE,CAAA;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC;SACjF,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,EAAE,CAAA"}
@@ -0,0 +1,32 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Compression types for implode
4
+ */
5
+ export declare enum Compression {
6
+ Unknown = -1,
7
+ Binary = 0,
8
+ Ascii = 1
9
+ }
10
+ /**
11
+ * Dictionary sizes for implode, determines how well the file get compressed.
12
+ *
13
+ * Small dictionary size means less memory to lookback in data for repetitions, meaning it will be less effective, the file stays larger, less compressed.
14
+ * On the other hand, large compression allows more lookback allowing more effective compression, thus generating smaller, more compressed files.
15
+ */
16
+ export declare enum DictionarySize {
17
+ Unknown = -1,
18
+ Small = 4,
19
+ Medium = 5,
20
+ Large = 6
21
+ }
22
+ export declare const EMPTY_BUFFER: Buffer;
23
+ export declare const LONGEST_ALLOWED_REPETITION = 516;
24
+ export declare const LITERAL_END_STREAM = 773;
25
+ export declare const DistCode: number[];
26
+ export declare const DistBits: number[];
27
+ export declare const LenBits: number[];
28
+ export declare const LenCode: number[];
29
+ export declare const ExLenBits: number[];
30
+ export declare const LenBase: number[];
31
+ export declare const ChBitsAsc: number[];
32
+ export declare const ChCodeAsc: number[];
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChCodeAsc = exports.ChBitsAsc = exports.LenBase = exports.ExLenBits = exports.LenCode = exports.LenBits = exports.DistBits = exports.DistCode = exports.LITERAL_END_STREAM = exports.LONGEST_ALLOWED_REPETITION = exports.EMPTY_BUFFER = exports.DictionarySize = exports.Compression = void 0;
4
+ /**
5
+ * Compression types for implode
6
+ */
7
+ var Compression;
8
+ (function (Compression) {
9
+ Compression[Compression["Unknown"] = -1] = "Unknown";
10
+ Compression[Compression["Binary"] = 0] = "Binary";
11
+ Compression[Compression["Ascii"] = 1] = "Ascii";
12
+ })(Compression = exports.Compression || (exports.Compression = {}));
13
+ /**
14
+ * Dictionary sizes for implode, determines how well the file get compressed.
15
+ *
16
+ * Small dictionary size means less memory to lookback in data for repetitions, meaning it will be less effective, the file stays larger, less compressed.
17
+ * On the other hand, large compression allows more lookback allowing more effective compression, thus generating smaller, more compressed files.
18
+ */
19
+ var DictionarySize;
20
+ (function (DictionarySize) {
21
+ DictionarySize[DictionarySize["Unknown"] = -1] = "Unknown";
22
+ DictionarySize[DictionarySize["Small"] = 4] = "Small";
23
+ DictionarySize[DictionarySize["Medium"] = 5] = "Medium";
24
+ DictionarySize[DictionarySize["Large"] = 6] = "Large";
25
+ })(DictionarySize = exports.DictionarySize || (exports.DictionarySize = {}));
26
+ exports.EMPTY_BUFFER = Buffer.from([]);
27
+ exports.LONGEST_ALLOWED_REPETITION = 0x204;
28
+ exports.LITERAL_END_STREAM = 0x305;
29
+ // prettier-ignore
30
+ exports.DistCode = [
31
+ 0x03, 0x0D, 0x05, 0x19, 0x09, 0x11, 0x01, 0x3E, 0x1E, 0x2E, 0x0E, 0x36, 0x16, 0x26, 0x06, 0x3A,
32
+ 0x1A, 0x2A, 0x0A, 0x32, 0x12, 0x22, 0x42, 0x02, 0x7C, 0x3C, 0x5C, 0x1C, 0x6C, 0x2C, 0x4C, 0x0C,
33
+ 0x74, 0x34, 0x54, 0x14, 0x64, 0x24, 0x44, 0x04, 0x78, 0x38, 0x58, 0x18, 0x68, 0x28, 0x48, 0x08,
34
+ 0xF0, 0x70, 0xB0, 0x30, 0xD0, 0x50, 0x90, 0x10, 0xE0, 0x60, 0xA0, 0x20, 0xC0, 0x40, 0x80, 0x00
35
+ ];
36
+ // prettier-ignore
37
+ exports.DistBits = [
38
+ 0x02, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,
39
+ 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
40
+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
41
+ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08
42
+ ];
43
+ // prettier-ignore
44
+ exports.LenBits = [
45
+ 0x03, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x06, 0x06, 0x06, 0x07, 0x07
46
+ ];
47
+ // prettier-ignore
48
+ exports.LenCode = [
49
+ 0x05, 0x03, 0x01, 0x06, 0x0a, 0x02, 0x0c, 0x14, 0x04, 0x18, 0x08, 0x30, 0x10, 0x20, 0x40, 0x00
50
+ ];
51
+ // prettier-ignore
52
+ exports.ExLenBits = [
53
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
54
+ ];
55
+ // prettier-ignore
56
+ exports.LenBase = [
57
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
58
+ 0x0008, 0x000A, 0x000E, 0x0016, 0x0026, 0x0046, 0x0086, 0x0106
59
+ ];
60
+ // prettier-ignore
61
+ exports.ChBitsAsc = [
62
+ 0x0B, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x08, 0x07, 0x0C, 0x0C, 0x07, 0x0C, 0x0C,
63
+ 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,
64
+ 0x04, 0x0A, 0x08, 0x0C, 0x0A, 0x0C, 0x0A, 0x08, 0x07, 0x07, 0x08, 0x09, 0x07, 0x06, 0x07, 0x08,
65
+ 0x07, 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x07, 0x07, 0x08, 0x08, 0x0C, 0x0B, 0x07, 0x09, 0x0B,
66
+ 0x0C, 0x06, 0x07, 0x06, 0x06, 0x05, 0x07, 0x08, 0x08, 0x06, 0x0B, 0x09, 0x06, 0x07, 0x06, 0x06,
67
+ 0x07, 0x0B, 0x06, 0x06, 0x06, 0x07, 0x09, 0x08, 0x09, 0x09, 0x0B, 0x08, 0x0B, 0x09, 0x0C, 0x08,
68
+ 0x0C, 0x05, 0x06, 0x06, 0x06, 0x05, 0x06, 0x06, 0x06, 0x05, 0x0B, 0x07, 0x05, 0x06, 0x05, 0x05,
69
+ 0x06, 0x0A, 0x05, 0x05, 0x05, 0x05, 0x08, 0x07, 0x08, 0x08, 0x0A, 0x0B, 0x0B, 0x0C, 0x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, 0x0B60, 0x0360,
84
+ 0x0D60, 0x0560, 0x1240, 0x0960, 0x0160, 0x0E60, 0x0660, 0x0A60,
85
+ 0x000F, 0x0250, 0x0038, 0x0260, 0x0050, 0x0C60, 0x0390, 0x00D8,
86
+ 0x0042, 0x0002, 0x0058, 0x01B0, 0x007C, 0x0029, 0x003C, 0x0098,
87
+ 0x005C, 0x0009, 0x001C, 0x006C, 0x002C, 0x004C, 0x0018, 0x000C,
88
+ 0x0074, 0x00E8, 0x0068, 0x0460, 0x0090, 0x0034, 0x00B0, 0x0710,
89
+ 0x0860, 0x0031, 0x0054, 0x0011, 0x0021, 0x0017, 0x0014, 0x00A8,
90
+ 0x0028, 0x0001, 0x0310, 0x0130, 0x003E, 0x0064, 0x001E, 0x002E,
91
+ 0x0024, 0x0510, 0x000E, 0x0036, 0x0016, 0x0044, 0x0030, 0x00C8,
92
+ 0x01D0, 0x00D0, 0x0110, 0x0048, 0x0610, 0x0150, 0x0060, 0x0088,
93
+ 0x0FA0, 0x0007, 0x0026, 0x0006, 0x003A, 0x001B, 0x001A, 0x002A,
94
+ 0x000A, 0x000B, 0x0210, 0x0004, 0x0013, 0x0032, 0x0003, 0x001D,
95
+ 0x0012, 0x0190, 0x000D, 0x0015, 0x0005, 0x0019, 0x0008, 0x0078,
96
+ 0x00F0, 0x0070, 0x0290, 0x0410, 0x0010, 0x07A0, 0x0BA0, 0x03A0,
97
+ 0x0240, 0x1C40, 0x0C40, 0x1440, 0x0440, 0x1840, 0x0840, 0x1040,
98
+ 0x0040, 0x1F80, 0x0F80, 0x1780, 0x0780, 0x1B80, 0x0B80, 0x1380,
99
+ 0x0380, 0x1D80, 0x0D80, 0x1580, 0x0580, 0x1980, 0x0980, 0x1180,
100
+ 0x0180, 0x1E80, 0x0E80, 0x1680, 0x0680, 0x1A80, 0x0A80, 0x1280,
101
+ 0x0280, 0x1C80, 0x0C80, 0x1480, 0x0480, 0x1880, 0x0880, 0x1080,
102
+ 0x0080, 0x1F00, 0x0F00, 0x1700, 0x0700, 0x1B00, 0x0B00, 0x1300,
103
+ 0x0DA0, 0x05A0, 0x09A0, 0x01A0, 0x0EA0, 0x06A0, 0x0AA0, 0x02A0,
104
+ 0x0CA0, 0x04A0, 0x08A0, 0x00A0, 0x0F20, 0x0720, 0x0B20, 0x0320,
105
+ 0x0D20, 0x0520, 0x0920, 0x0120, 0x0E20, 0x0620, 0x0A20, 0x0220,
106
+ 0x0C20, 0x0420, 0x0820, 0x0020, 0x0FC0, 0x07C0, 0x0BC0, 0x03C0,
107
+ 0x0DC0, 0x05C0, 0x09C0, 0x01C0, 0x0EC0, 0x06C0, 0x0AC0, 0x02C0,
108
+ 0x0CC0, 0x04C0, 0x08C0, 0x00C0, 0x0F40, 0x0740, 0x0B40, 0x0340,
109
+ 0x0300, 0x0D40, 0x1D00, 0x0D00, 0x1500, 0x0540, 0x0500, 0x1900,
110
+ 0x0900, 0x0940, 0x1100, 0x0100, 0x1E00, 0x0E00, 0x0140, 0x1600,
111
+ 0x0600, 0x1A00, 0x0E40, 0x0640, 0x0A40, 0x0A00, 0x1200, 0x0200,
112
+ 0x1C00, 0x0C00, 0x1400, 0x0400, 0x1800, 0x0800, 0x1000, 0x0000
113
+ ];
114
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,oDAAY,CAAA;IACZ,iDAAU,CAAA;IACV,+CAAK,CAAA;AACP,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED;;;;;GAKG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,0DAAY,CAAA;IACZ,qDAAS,CAAA;IACT,uDAAM,CAAA;IACN,qDAAK,CAAA;AACP,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAEY,QAAA,YAAY,GAAG,MAA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AAE,MAAM,EAAE,MAAM;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC9D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAC/D,CAAA"}
@@ -3,28 +3,30 @@
3
3
  * - `implode` when invalid dictionary size was specified
4
4
  * - `explode` when it encounters invalid data in the header section (the first 2 bytes of a compressed files)
5
5
  */
6
- export class InvalidDictionarySizeError extends Error {}
7
-
6
+ export declare class InvalidDictionarySizeError extends Error {
7
+ constructor();
8
+ }
8
9
  /**
9
10
  * Thrown by
10
11
  * - `implode` when invalid compression type was specified
11
12
  * - `explode` when it encounters invalid data in the header section (the first 2 bytes of a compressed files)
12
13
  */
13
- export class InvalidCompressionTypeError extends Error {}
14
-
14
+ export declare class InvalidCompressionTypeError extends Error {
15
+ constructor();
16
+ }
15
17
  /**
16
18
  * Thrown by
17
19
  * - `explode`, when compressed data is less, than `5` bytes long
18
- *
20
+ *
19
21
  * Pkware compressed files have 2 bytes header followed by at lest 2 bytes of data and an end literal.
20
22
  */
21
- export class InvalidDataError extends Error {}
22
-
23
+ export declare class InvalidDataError extends Error {
24
+ constructor();
25
+ }
23
26
  /**
24
27
  * Thrown by
25
28
  * - `explode` when compressed data ends without reaching the end literal or in mid decompression
26
29
  */
27
- export class AbortedError extends Error {}
28
-
29
- export class ExpectedBufferError extends TypeError {}
30
- export class ExpectedFunctionError extends TypeError {}
30
+ export declare class AbortedError extends Error {
31
+ constructor();
32
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbortedError = exports.InvalidDataError = exports.InvalidCompressionTypeError = exports.InvalidDictionarySizeError = void 0;
4
+ /**
5
+ * Thrown by
6
+ * - `implode` when invalid dictionary size was specified
7
+ * - `explode` when it encounters invalid data in the header section (the first 2 bytes of a compressed files)
8
+ */
9
+ class InvalidDictionarySizeError extends Error {
10
+ constructor() {
11
+ super('Invalid dictionary size');
12
+ this.name = 'InvalidDictionarySizeError';
13
+ }
14
+ }
15
+ exports.InvalidDictionarySizeError = InvalidDictionarySizeError;
16
+ /**
17
+ * Thrown by
18
+ * - `implode` when invalid compression type was specified
19
+ * - `explode` when it encounters invalid data in the header section (the first 2 bytes of a compressed files)
20
+ */
21
+ class InvalidCompressionTypeError extends Error {
22
+ constructor() {
23
+ super('Invalid compression type');
24
+ this.name = 'InvalidCompressionTypeError';
25
+ }
26
+ }
27
+ exports.InvalidCompressionTypeError = InvalidCompressionTypeError;
28
+ /**
29
+ * Thrown by
30
+ * - `explode`, when compressed data is less, than `5` bytes long
31
+ *
32
+ * Pkware compressed files have 2 bytes header followed by at lest 2 bytes of data and an end literal.
33
+ */
34
+ class InvalidDataError extends Error {
35
+ constructor() {
36
+ super('Invalid data');
37
+ this.name = 'InvalidDataError';
38
+ }
39
+ }
40
+ exports.InvalidDataError = InvalidDataError;
41
+ /**
42
+ * Thrown by
43
+ * - `explode` when compressed data ends without reaching the end literal or in mid decompression
44
+ */
45
+ class AbortedError extends Error {
46
+ constructor() {
47
+ super('Aborted');
48
+ this.name = 'AbortedError';
49
+ }
50
+ }
51
+ exports.AbortedError = AbortedError;
52
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,KAAK;IACnD;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;IAC1C,CAAC;CACF;AALD,gEAKC;AAED;;;;GAIG;AACH,MAAa,2BAA4B,SAAQ,KAAK;IACpD;QACE,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;IAC3C,CAAC;CACF;AALD,kEAKC;AAED;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,CAAC,cAAc,CAAC,CAAA;QACrB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAChC,CAAC;CACF;AALD,4CAKC;AAED;;;GAGG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC;QACE,KAAK,CAAC,SAAS,CAAC,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC5B,CAAC;CACF;AALD,oCAKC"}
@@ -0,0 +1,11 @@
1
+ export declare const repeat: <T>(value: T, repetitions: number) => T[];
2
+ export declare const clamp: (min: number, max: number, n: number) => number;
3
+ export declare const clone: <T>(data: T) => T;
4
+ export declare const isFunction: (x: any) => x is Function;
5
+ export declare const nBitsOfOnes: (numberOfBits: number) => number;
6
+ export declare const getLowestNBits: (numberOfBits: number, number: number) => number;
7
+ export declare const toHex: (num: number, digits?: number, withoutPrefix?: boolean) => string;
8
+ export declare const mergeSparseArrays: <T>(a: T[], b: T[]) => (T | undefined)[];
9
+ export declare const last: <T>(arr: T[]) => T;
10
+ export declare const unfold: <T, TResult>(fn: (seed: T) => false | [TResult, T], seed: T) => TResult[];
11
+ export declare const evenAndRemainder: (divisor: number, n: number) => [number, number];
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evenAndRemainder = exports.unfold = exports.last = exports.mergeSparseArrays = exports.toHex = exports.getLowestNBits = exports.nBitsOfOnes = exports.isFunction = exports.clone = exports.clamp = exports.repeat = void 0;
4
+ const repeat = (value, repetitions) => {
5
+ return Array(repetitions).fill(value);
6
+ };
7
+ exports.repeat = repeat;
8
+ const clamp = (min, max, n) => {
9
+ if (n < min) {
10
+ return min;
11
+ }
12
+ if (n > max) {
13
+ return max;
14
+ }
15
+ return n;
16
+ };
17
+ exports.clamp = clamp;
18
+ const clone = (data) => {
19
+ return JSON.parse(JSON.stringify(data));
20
+ };
21
+ exports.clone = clone;
22
+ const isFunction = (x) => {
23
+ return Object.prototype.toString.call(x) === '[object Function]';
24
+ };
25
+ exports.isFunction = isFunction;
26
+ const nBitsOfOnes = (numberOfBits) => {
27
+ if (!Number.isInteger(numberOfBits) || numberOfBits < 0) {
28
+ return 0;
29
+ }
30
+ return (1 << numberOfBits) - 1;
31
+ };
32
+ exports.nBitsOfOnes = nBitsOfOnes;
33
+ const getLowestNBits = (numberOfBits, number) => {
34
+ return number & (0, exports.nBitsOfOnes)(numberOfBits);
35
+ };
36
+ exports.getLowestNBits = getLowestNBits;
37
+ const toHex = (num, digits = 0, withoutPrefix = false) => {
38
+ if (!Number.isInteger(num) || !Number.isInteger(digits) || digits < 0) {
39
+ return '';
40
+ }
41
+ const prefix = withoutPrefix ? '' : '0x';
42
+ return `${prefix}${num.toString(16).padStart(digits, '0')}`;
43
+ };
44
+ exports.toHex = toHex;
45
+ const mergeSparseArrays = (a, b) => {
46
+ const result = [...b, ...(b.length < a.length ? (0, exports.repeat)(undefined, a.length - b.length) : [])];
47
+ for (let i = 0; i < a.length; i++) {
48
+ if (typeof a[i] !== 'undefined') {
49
+ result[i] = a[i];
50
+ }
51
+ }
52
+ return result;
53
+ };
54
+ exports.mergeSparseArrays = mergeSparseArrays;
55
+ const last = (arr) => {
56
+ return arr[arr.length - 1];
57
+ };
58
+ exports.last = last;
59
+ const unfold = (fn, seed) => {
60
+ let pair = fn(seed);
61
+ const result = [];
62
+ while (pair && pair.length) {
63
+ result[result.length] = pair[0];
64
+ pair = fn(pair[1]);
65
+ }
66
+ return result;
67
+ };
68
+ exports.unfold = unfold;
69
+ const evenAndRemainder = (divisor, n) => {
70
+ return [Math.floor(n / divisor), n % divisor];
71
+ };
72
+ exports.evenAndRemainder = evenAndRemainder;
73
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAI,KAAQ,EAAE,WAAmB,EAAO,EAAE;IAC9D,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC,CAAA;AAFY,QAAA,MAAM,UAElB;AAEM,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,CAAS,EAAE,EAAE;IAC3D,IAAI,CAAC,GAAG,GAAG,EAAE;QACX,OAAO,GAAG,CAAA;KACX;IACD,IAAI,CAAC,GAAG,GAAG,EAAE;QACX,OAAO,GAAG,CAAA;KACX;IACD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AARY,QAAA,KAAK,SAQjB;AAEM,MAAM,KAAK,GAAG,CAAI,IAAO,EAAK,EAAE;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA;AAFY,QAAA,KAAK,SAEjB;AAEM,MAAM,UAAU,GAAG,CAAC,CAAM,EAAiB,EAAE;IAClD,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAA;AAClE,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,MAAM,WAAW,GAAG,CAAC,YAAoB,EAAE,EAAE;IAClD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE;QACvD,OAAO,CAAC,CAAA;KACT;IAED,OAAO,CAAC,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,CA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C,CAAA;SACjB;KACF;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAVY,QAAA,iBAAiB,qBAU7B;AAEM,MAAM,IAAI,GAAG,CAAI,GAAQ,EAAE,EAAE;IAClC,OAAO,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAC5B,CAAC,CAAA;AAFY,QAAA,IAAI,QAEhB;AAEM,MAAM,MAAM,GAAG,CAAa,EAAqC,EAAE,IAAO,EAAa,EAAE;IAC9F,IAAI,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IACnB,MAAM,MAAM,GAAc,EAAE,CAAA;IAC5B,OAAO,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;QAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;KACnB;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AARY,QAAA,MAAM,UAQlB;AAEM,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,CAAS,EAAoB,EAAE;IAC/E,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAA;AAC/C,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B"}
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Compression, DictionarySize } from './constants';
4
+ import { Config } from './types';
5
+ /**
6
+ * Decompresses stream
7
+ * @returns a function that you can use as a `transform._transform` method.
8
+ */
9
+ export declare const explode: (config?: Config) => (this: import("stream").Transform, chunk: Buffer, encoding: BufferEncoding, callback: import("stream").TransformCallback) => void;
10
+ /**
11
+ * Compresses stream
12
+ * @returns a function that you can use as a `transform._transform` method.
13
+ */
14
+ export declare const implode: (compressionType: Compression, dictionarySize: DictionarySize, config?: Config) => (this: import("stream").Transform, chunk: Buffer, encoding: BufferEncoding, callback: import("stream").TransformCallback) => void;
15
+ export { explode as decompress };
16
+ export { implode as compress };
17
+ export { Compression, DictionarySize } from './constants';
18
+ export * as errors from './errors';
19
+ export * as stream from './stream';
20
+ export type { Config } from './types';