node-pkware 3.0.4 → 4.0.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/ExpandingBuffer.d.ts +30 -3
- package/dist/ExpandingBuffer.js +83 -64
- package/dist/ExpandingBuffer.js.map +1 -1
- package/dist/Explode.d.ts +39 -4
- package/dist/Explode.js +170 -171
- package/dist/Explode.js.map +1 -1
- package/dist/Implode.d.ts +36 -7
- package/dist/Implode.js +165 -158
- package/dist/Implode.js.map +1 -1
- package/dist/bin/explode.js +47 -48
- package/dist/bin/explode.js.map +1 -1
- package/dist/bin/helpers.d.ts +4 -8
- package/dist/bin/helpers.js +31 -39
- package/dist/bin/helpers.js.map +1 -1
- package/dist/bin/implode.js +85 -61
- package/dist/bin/implode.js.map +1 -1
- package/dist/constants.d.ts +4 -3
- package/dist/constants.js +53 -54
- package/dist/constants.js.map +1 -1
- package/dist/errors.js +4 -11
- package/dist/errors.js.map +1 -1
- package/dist/functions.d.ts +9 -11
- package/dist/functions.js +34 -44
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +9 -10
- package/dist/index.js +13 -43
- package/dist/index.js.map +1 -1
- package/dist/stream.d.ts +17 -11
- package/dist/stream.js +64 -69
- package/dist/stream.js.map +1 -1
- package/dist/types.js +1 -2
- package/package.json +18 -11
- package/dist/tsconfig.tsbuildinfo +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Lajos Mészáros
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,23 +1,49 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Buffer } from 'node:buffer';
|
|
3
2
|
export declare class ExpandingBuffer {
|
|
4
|
-
|
|
3
|
+
private heap;
|
|
4
|
+
private startIndex;
|
|
5
|
+
private endIndex;
|
|
6
|
+
private readonly backup;
|
|
5
7
|
constructor(numberOfBytes?: number);
|
|
8
|
+
/**
|
|
9
|
+
* Returns the number of bytes in the stored data.
|
|
10
|
+
*/
|
|
6
11
|
size(): number;
|
|
7
12
|
isEmpty(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the underlying Buffer's (heap) size.
|
|
15
|
+
*/
|
|
8
16
|
heapSize(): number;
|
|
9
17
|
/**
|
|
10
|
-
*
|
|
18
|
+
* Sets a single byte of the stored data
|
|
11
19
|
*
|
|
12
20
|
* If offset is negative, then the method calculates the index from the end backwards
|
|
13
21
|
*/
|
|
14
22
|
setByte(offset: number, value: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Adds a single byte to the end of the stored data.
|
|
25
|
+
* This expands the internal buffer by 0x1000 bytes if the heap is full
|
|
26
|
+
*/
|
|
15
27
|
appendByte(value: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Concatenates a buffer to the end of the stored data.
|
|
30
|
+
* If the new data exceeds the size of the heap then the internal heap
|
|
31
|
+
* gets expanded by the integer multiples of 0x1000 bytes
|
|
32
|
+
*/
|
|
16
33
|
append(newData: Buffer): void;
|
|
17
34
|
/**
|
|
35
|
+
* Returns a slice of data from the internal data.
|
|
36
|
+
* If no parameters are given then the whole amount of stored data is returned.
|
|
37
|
+
* Optionally an offset and a limit can be specified:
|
|
38
|
+
* offset determines the starting position, limit specifies the number of bytes read.
|
|
39
|
+
*
|
|
18
40
|
* Watch out! The returned slice of Buffer points to the same Buffer in memory!
|
|
41
|
+
* This is intentional for performance reasons.
|
|
19
42
|
*/
|
|
20
43
|
read(offset?: number, limit?: number): Buffer;
|
|
44
|
+
/**
|
|
45
|
+
* Reads a single byte from the stored data
|
|
46
|
+
*/
|
|
21
47
|
readByte(offset?: number): number;
|
|
22
48
|
/**
|
|
23
49
|
* Does hard delete
|
|
@@ -57,4 +83,5 @@ export declare class ExpandingBuffer {
|
|
|
57
83
|
clear(): void;
|
|
58
84
|
saveIndices(): void;
|
|
59
85
|
restoreIndices(): void;
|
|
86
|
+
private getActualData;
|
|
60
87
|
}
|
package/dist/ExpandingBuffer.js
CHANGED
|
@@ -1,91 +1,108 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
#endIndex = 0;
|
|
11
|
-
#backup = {
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { EMPTY_BUFFER } from './constants.js';
|
|
3
|
+
import { clamp } from './functions.js';
|
|
4
|
+
const blockSize = 0x10_00;
|
|
5
|
+
export class ExpandingBuffer {
|
|
6
|
+
heap;
|
|
7
|
+
startIndex = 0;
|
|
8
|
+
endIndex = 0;
|
|
9
|
+
backup = {
|
|
12
10
|
startIndex: 0,
|
|
13
11
|
endIndex: 0,
|
|
14
12
|
};
|
|
15
13
|
constructor(numberOfBytes = 0) {
|
|
16
|
-
this
|
|
17
|
-
}
|
|
18
|
-
#getActualData(offset = 0) {
|
|
19
|
-
return this.#heap.subarray(this.#startIndex + offset, this.#endIndex);
|
|
14
|
+
this.heap = Buffer.allocUnsafe(numberOfBytes);
|
|
20
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the number of bytes in the stored data.
|
|
18
|
+
*/
|
|
21
19
|
size() {
|
|
22
|
-
return this
|
|
20
|
+
return this.endIndex - this.startIndex;
|
|
23
21
|
}
|
|
24
22
|
isEmpty() {
|
|
25
23
|
return this.size() === 0;
|
|
26
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the underlying Buffer's (heap) size.
|
|
27
|
+
*/
|
|
27
28
|
heapSize() {
|
|
28
|
-
return this
|
|
29
|
+
return this.heap.byteLength;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* Sets a single byte of the stored data
|
|
32
33
|
*
|
|
33
34
|
* If offset is negative, then the method calculates the index from the end backwards
|
|
34
35
|
*/
|
|
35
36
|
setByte(offset, value) {
|
|
36
37
|
if (offset < 0) {
|
|
37
|
-
if (this
|
|
38
|
+
if (this.endIndex + offset < this.startIndex) {
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
this
|
|
41
|
+
this.heap[this.endIndex + offset] = value;
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
if (this
|
|
44
|
-
this
|
|
44
|
+
if (this.startIndex + offset >= this.endIndex) {
|
|
45
|
+
this.heap[this.startIndex + offset] = value;
|
|
45
46
|
}
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Adds a single byte to the end of the stored data.
|
|
50
|
+
* This expands the internal buffer by 0x1000 bytes if the heap is full
|
|
51
|
+
*/
|
|
47
52
|
appendByte(value) {
|
|
48
|
-
if (this
|
|
49
|
-
this
|
|
50
|
-
this
|
|
53
|
+
if (this.endIndex + 1 < this.heapSize()) {
|
|
54
|
+
this.heap[this.endIndex] = value;
|
|
55
|
+
this.endIndex = this.endIndex + 1;
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
currentData.
|
|
57
|
-
this
|
|
58
|
-
this
|
|
59
|
-
this.#endIndex = currentData.byteLength + 1;
|
|
58
|
+
const currentData = this.getActualData();
|
|
59
|
+
this.heap = Buffer.allocUnsafe((Math.ceil((currentData.byteLength + 1) / blockSize) + 1) * blockSize);
|
|
60
|
+
currentData.copy(this.heap, 0);
|
|
61
|
+
this.heap[currentData.byteLength] = value;
|
|
62
|
+
this.startIndex = 0;
|
|
63
|
+
this.endIndex = currentData.byteLength + 1;
|
|
60
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Concatenates a buffer to the end of the stored data.
|
|
67
|
+
* If the new data exceeds the size of the heap then the internal heap
|
|
68
|
+
* gets expanded by the integer multiples of 0x1000 bytes
|
|
69
|
+
*/
|
|
61
70
|
append(newData) {
|
|
62
|
-
if (this
|
|
63
|
-
newData.copy(this
|
|
64
|
-
this
|
|
71
|
+
if (this.endIndex + newData.byteLength < this.heapSize()) {
|
|
72
|
+
newData.copy(this.heap, this.endIndex);
|
|
73
|
+
this.endIndex = this.endIndex + newData.byteLength;
|
|
65
74
|
return;
|
|
66
75
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this
|
|
73
|
-
this.#endIndex = currentData.byteLength + newData.byteLength;
|
|
76
|
+
const currentData = this.getActualData();
|
|
77
|
+
this.heap = Buffer.allocUnsafe((Math.ceil((currentData.byteLength + newData.byteLength) / blockSize) + 1) * blockSize);
|
|
78
|
+
currentData.copy(this.heap, 0);
|
|
79
|
+
newData.copy(this.heap, currentData.byteLength);
|
|
80
|
+
this.startIndex = 0;
|
|
81
|
+
this.endIndex = currentData.byteLength + newData.byteLength;
|
|
74
82
|
}
|
|
75
83
|
/**
|
|
84
|
+
* Returns a slice of data from the internal data.
|
|
85
|
+
* If no parameters are given then the whole amount of stored data is returned.
|
|
86
|
+
* Optionally an offset and a limit can be specified:
|
|
87
|
+
* offset determines the starting position, limit specifies the number of bytes read.
|
|
88
|
+
*
|
|
76
89
|
* Watch out! The returned slice of Buffer points to the same Buffer in memory!
|
|
90
|
+
* This is intentional for performance reasons.
|
|
77
91
|
*/
|
|
78
92
|
read(offset = 0, limit = this.size()) {
|
|
79
93
|
if (offset < 0 || limit < 1) {
|
|
80
|
-
return
|
|
94
|
+
return EMPTY_BUFFER;
|
|
81
95
|
}
|
|
82
96
|
if (offset + limit < this.size()) {
|
|
83
|
-
return this
|
|
97
|
+
return this.heap.subarray(this.startIndex + offset, this.startIndex + limit + offset);
|
|
84
98
|
}
|
|
85
|
-
return this
|
|
99
|
+
return this.getActualData(offset);
|
|
86
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Reads a single byte from the stored data
|
|
103
|
+
*/
|
|
87
104
|
readByte(offset = 0) {
|
|
88
|
-
return this
|
|
105
|
+
return this.heap[this.startIndex + offset];
|
|
89
106
|
}
|
|
90
107
|
/**
|
|
91
108
|
* Does hard delete
|
|
@@ -95,13 +112,13 @@ class ExpandingBuffer {
|
|
|
95
112
|
* startIndex goes back to 0 afterwards
|
|
96
113
|
*/
|
|
97
114
|
flushStart(numberOfBytes) {
|
|
98
|
-
numberOfBytes =
|
|
115
|
+
numberOfBytes = clamp(0, this.heapSize(), numberOfBytes);
|
|
99
116
|
if (numberOfBytes > 0) {
|
|
100
117
|
if (numberOfBytes < this.heapSize()) {
|
|
101
|
-
this
|
|
118
|
+
this.heap.copy(this.heap, 0, this.startIndex + numberOfBytes);
|
|
102
119
|
}
|
|
103
|
-
this
|
|
104
|
-
this
|
|
120
|
+
this.endIndex = this.endIndex - this.startIndex + numberOfBytes;
|
|
121
|
+
this.startIndex = 0;
|
|
105
122
|
}
|
|
106
123
|
}
|
|
107
124
|
/**
|
|
@@ -111,9 +128,9 @@ class ExpandingBuffer {
|
|
|
111
128
|
* by moving the endIndex back
|
|
112
129
|
*/
|
|
113
130
|
flushEnd(numberOfBytes) {
|
|
114
|
-
const clampedNumberOfBytes =
|
|
131
|
+
const clampedNumberOfBytes = clamp(0, this.heapSize(), numberOfBytes);
|
|
115
132
|
if (clampedNumberOfBytes > 0) {
|
|
116
|
-
this
|
|
133
|
+
this.endIndex = this.endIndex - clampedNumberOfBytes;
|
|
117
134
|
}
|
|
118
135
|
}
|
|
119
136
|
/**
|
|
@@ -127,8 +144,8 @@ class ExpandingBuffer {
|
|
|
127
144
|
if (numberOfBytes <= 0) {
|
|
128
145
|
return;
|
|
129
146
|
}
|
|
130
|
-
this
|
|
131
|
-
if (this
|
|
147
|
+
this.startIndex = this.startIndex + numberOfBytes;
|
|
148
|
+
if (this.startIndex >= this.endIndex) {
|
|
132
149
|
this.clear();
|
|
133
150
|
}
|
|
134
151
|
}
|
|
@@ -143,8 +160,8 @@ class ExpandingBuffer {
|
|
|
143
160
|
if (numberOfBytes <= 0) {
|
|
144
161
|
return;
|
|
145
162
|
}
|
|
146
|
-
this
|
|
147
|
-
if (this
|
|
163
|
+
this.endIndex = this.endIndex - numberOfBytes;
|
|
164
|
+
if (this.startIndex >= this.endIndex) {
|
|
148
165
|
this.clear();
|
|
149
166
|
}
|
|
150
167
|
}
|
|
@@ -152,20 +169,22 @@ class ExpandingBuffer {
|
|
|
152
169
|
* returns the internal buffer
|
|
153
170
|
*/
|
|
154
171
|
getHeap() {
|
|
155
|
-
return this
|
|
172
|
+
return this.heap;
|
|
156
173
|
}
|
|
157
174
|
clear() {
|
|
158
|
-
this
|
|
159
|
-
this
|
|
175
|
+
this.startIndex = 0;
|
|
176
|
+
this.endIndex = 0;
|
|
160
177
|
}
|
|
161
178
|
saveIndices() {
|
|
162
|
-
this
|
|
163
|
-
this
|
|
179
|
+
this.backup.startIndex = this.startIndex;
|
|
180
|
+
this.backup.endIndex = this.endIndex;
|
|
164
181
|
}
|
|
165
182
|
restoreIndices() {
|
|
166
|
-
this
|
|
167
|
-
this
|
|
183
|
+
this.startIndex = this.backup.startIndex;
|
|
184
|
+
this.endIndex = this.backup.endIndex;
|
|
185
|
+
}
|
|
186
|
+
getActualData(offset = 0) {
|
|
187
|
+
return this.heap.subarray(this.startIndex + offset, this.endIndex);
|
|
168
188
|
}
|
|
169
189
|
}
|
|
170
|
-
exports.ExpandingBuffer = ExpandingBuffer;
|
|
171
190
|
//# sourceMappingURL=ExpandingBuffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandingBuffer.js","sourceRoot":"","sources":["../src/ExpandingBuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpandingBuffer.js","sourceRoot":"","sources":["../src/ExpandingBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAA;AAEzB,MAAM,OAAO,eAAe;IAClB,IAAI,CAAQ;IACZ,UAAU,GAAW,CAAC,CAAA;IACtB,QAAQ,GAAW,CAAC,CAAA;IACX,MAAM,GAA6C;QAClE,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;KACZ,CAAA;IAED,YAAY,gBAAwB,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAA;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAA;IACxC,CAAC;IAED,OAAO;QACL,OAAO,IA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AAC,QAAQ,CAAC,CAAA;IACpE,CAAC;CACF"}
|
package/dist/Explode.d.ts
CHANGED
|
@@ -1,9 +1,44 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Buffer } from 'node:buffer';
|
|
3
|
-
import { Transform, TransformCallback } from 'node:stream';
|
|
4
|
-
import { Config } from './types';
|
|
2
|
+
import { type Transform, type TransformCallback } from 'node:stream';
|
|
3
|
+
import { type Config } from './types.js';
|
|
5
4
|
export declare class Explode {
|
|
6
|
-
|
|
5
|
+
private readonly verbose;
|
|
6
|
+
private needMoreInput;
|
|
7
|
+
private isFirstChunk;
|
|
8
|
+
private extraBits;
|
|
9
|
+
private bitBuffer;
|
|
10
|
+
private readonly backupData;
|
|
11
|
+
private readonly lengthCodes;
|
|
12
|
+
private readonly distPosCodes;
|
|
13
|
+
private readonly inputBuffer;
|
|
14
|
+
private readonly outputBuffer;
|
|
15
|
+
private readonly stats;
|
|
16
|
+
private compressionType;
|
|
17
|
+
private dictionarySize;
|
|
18
|
+
private dictionarySizeMask;
|
|
19
|
+
private chBitsAsc;
|
|
20
|
+
private asciiTable2C34;
|
|
21
|
+
private asciiTable2D34;
|
|
22
|
+
private asciiTable2E34;
|
|
23
|
+
private asciiTable2EB4;
|
|
7
24
|
constructor(config?: Config);
|
|
8
25
|
getHandler(): (this: Transform, chunk: Buffer, encoding: BufferEncoding, callback: TransformCallback) => void;
|
|
26
|
+
private generateAsciiTables;
|
|
27
|
+
private onInputFinished;
|
|
28
|
+
/**
|
|
29
|
+
* @throws {@link AbortedError} when there isn't enough data to be wasted
|
|
30
|
+
*/
|
|
31
|
+
private wasteBits;
|
|
32
|
+
/**
|
|
33
|
+
* @throws {@link AbortedError}
|
|
34
|
+
*/
|
|
35
|
+
private decodeNextLiteral;
|
|
36
|
+
/**
|
|
37
|
+
* @throws {@link AbortedError}
|
|
38
|
+
*/
|
|
39
|
+
private decodeDistance;
|
|
40
|
+
private processChunkData;
|
|
41
|
+
private parseInitialData;
|
|
42
|
+
private backup;
|
|
43
|
+
private restore;
|
|
9
44
|
}
|