node-pkware 3.0.5 → 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/dist/ExpandingBuffer.d.ts +5 -2
- package/dist/ExpandingBuffer.js +58 -62
- 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 +0 -1
- package/dist/constants.js +49 -52
- 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 +13 -6
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/Implode.js
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const functions_1 = require("./functions");
|
|
9
|
-
const getSizeOfMatching = (inputBytes, a, b) => {
|
|
10
|
-
const limit = (0, functions_1.clamp)(2, constants_1.LONGEST_ALLOWED_REPETITION, b - a);
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { ChBitsAsc, ChCodeAsc, Compression, DictionarySize, DistBits, DistCode, EMPTY_BUFFER, ExLenBits, LenBits, LenCode, LONGEST_ALLOWED_REPETITION, } from './constants.js';
|
|
3
|
+
import { InvalidCompressionTypeError, InvalidDictionarySizeError } from './errors.js';
|
|
4
|
+
import { ExpandingBuffer } from './ExpandingBuffer.js';
|
|
5
|
+
import { clamp, evenAndRemainder, getLowestNBits, nBitsOfOnes, repeat, toHex } from './functions.js';
|
|
6
|
+
export function getSizeOfMatching(inputBytes, a, b) {
|
|
7
|
+
const limit = clamp(2, LONGEST_ALLOWED_REPETITION, b - a);
|
|
11
8
|
for (let i = 2; i <= limit; i++) {
|
|
12
9
|
if (inputBytes[a + i] !== inputBytes[b + i]) {
|
|
13
10
|
return i;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
return limit;
|
|
17
|
-
}
|
|
18
|
-
exports.getSizeOfMatching = getSizeOfMatching;
|
|
14
|
+
}
|
|
19
15
|
/**
|
|
20
16
|
* TODO: make sure that we find the most recent one,
|
|
21
17
|
* which in turn allows us to store backward length in less amount of bits
|
|
22
18
|
* currently the code goes from the furthest point
|
|
23
19
|
*/
|
|
24
|
-
|
|
20
|
+
function findRepetitions(inputBytes, endOfLastMatch, cursor) {
|
|
25
21
|
const notEnoughBytes = inputBytes.length - cursor < 2;
|
|
26
22
|
const tooClose = cursor === endOfLastMatch || cursor - endOfLastMatch < 2;
|
|
27
23
|
if (notEnoughBytes || tooClose) {
|
|
@@ -32,132 +28,139 @@ const findRepetitions = (inputBytes, endOfLastMatch, cursor) => {
|
|
|
32
28
|
const matchIndex = haystack.indexOf(needle);
|
|
33
29
|
if (matchIndex !== -1) {
|
|
34
30
|
const distance = cursor - endOfLastMatch - matchIndex;
|
|
31
|
+
let size = 2;
|
|
32
|
+
if (distance > 2) {
|
|
33
|
+
size = getSizeOfMatching(inputBytes, endOfLastMatch + matchIndex, cursor);
|
|
34
|
+
}
|
|
35
35
|
return {
|
|
36
36
|
distance: distance - 1,
|
|
37
|
-
size
|
|
37
|
+
size,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
return { size: 0, distance: 0 };
|
|
41
|
-
}
|
|
42
|
-
class Implode {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
}
|
|
42
|
+
export class Implode {
|
|
43
|
+
verbose;
|
|
44
|
+
isFirstChunk = true;
|
|
45
|
+
inputBuffer;
|
|
46
|
+
outputBuffer;
|
|
47
|
+
stats = { chunkCounter: 0 };
|
|
48
|
+
compressionType;
|
|
49
|
+
dictionarySize;
|
|
50
|
+
dictionarySizeMask = -1;
|
|
51
|
+
streamEnded = false;
|
|
52
|
+
distCodes = structuredClone(DistCode);
|
|
53
|
+
distBits = structuredClone(DistBits);
|
|
54
|
+
startIndex = 0;
|
|
55
|
+
handledFirstTwoBytes = false;
|
|
56
|
+
outBits = 0;
|
|
57
|
+
nChBits = repeat(0, 0x3_06);
|
|
58
|
+
nChCodes = repeat(0, 0x3_06);
|
|
59
59
|
constructor(compressionType, dictionarySize, config) {
|
|
60
|
-
if (!(compressionType in
|
|
61
|
-
throw new
|
|
60
|
+
if (!(compressionType in Compression) || compressionType === Compression.Unknown) {
|
|
61
|
+
throw new InvalidCompressionTypeError();
|
|
62
62
|
}
|
|
63
|
-
if (!(dictionarySize in
|
|
64
|
-
throw new
|
|
63
|
+
if (!(dictionarySize in DictionarySize) || dictionarySize === DictionarySize.Unknown) {
|
|
64
|
+
throw new InvalidDictionarySizeError();
|
|
65
65
|
}
|
|
66
|
-
this
|
|
67
|
-
this
|
|
68
|
-
this
|
|
69
|
-
this
|
|
70
|
-
this
|
|
66
|
+
this.compressionType = compressionType;
|
|
67
|
+
this.dictionarySize = dictionarySize;
|
|
68
|
+
this.verbose = config?.verbose ?? false;
|
|
69
|
+
this.inputBuffer = new ExpandingBuffer(config?.inputBufferSize ?? 0);
|
|
70
|
+
this.outputBuffer = new ExpandingBuffer(config?.outputBufferSize ?? 0);
|
|
71
71
|
}
|
|
72
72
|
getHandler() {
|
|
73
|
-
const
|
|
73
|
+
const implodeInstance = this;
|
|
74
74
|
return function (chunk, encoding, callback) {
|
|
75
75
|
try {
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
this._flush =
|
|
76
|
+
implodeInstance.inputBuffer.append(chunk);
|
|
77
|
+
if (implodeInstance.isFirstChunk) {
|
|
78
|
+
implodeInstance.isFirstChunk = false;
|
|
79
|
+
this._flush = implodeInstance.onInputFinished.bind(implodeInstance);
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
console.log(`implode: reading ${
|
|
81
|
+
if (implodeInstance.verbose) {
|
|
82
|
+
implodeInstance.stats.chunkCounter++;
|
|
83
|
+
console.log(`implode: reading ${toHex(chunk.length)} bytes from chunk #${implodeInstance.stats.chunkCounter}`);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
const blockSize =
|
|
87
|
-
if (
|
|
88
|
-
callback(null,
|
|
85
|
+
implodeInstance.processChunkData();
|
|
86
|
+
const blockSize = 0x8_00;
|
|
87
|
+
if (implodeInstance.outputBuffer.size() <= blockSize) {
|
|
88
|
+
callback(null, EMPTY_BUFFER);
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
|
-
let [numberOfBlocks] =
|
|
91
|
+
let [numberOfBlocks] = evenAndRemainder(blockSize, implodeInstance.outputBuffer.size());
|
|
92
92
|
// making sure to leave one block worth of data for lookback when processing chunk data
|
|
93
93
|
numberOfBlocks--;
|
|
94
94
|
const numberOfBytes = numberOfBlocks * blockSize;
|
|
95
95
|
// make sure to create a copy of the output buffer slice as it will get flushed in the next line
|
|
96
|
-
const output =
|
|
97
|
-
|
|
98
|
-
if (
|
|
99
|
-
|
|
96
|
+
const output = Buffer.from(implodeInstance.outputBuffer.read(0, numberOfBytes));
|
|
97
|
+
implodeInstance.outputBuffer.flushStart(numberOfBytes);
|
|
98
|
+
if (implodeInstance.outBits === 0) {
|
|
99
|
+
implodeInstance.outputBuffer.setByte(-1, 0);
|
|
100
100
|
}
|
|
101
101
|
callback(null, output);
|
|
102
102
|
}
|
|
103
|
-
catch (
|
|
104
|
-
callback(
|
|
103
|
+
catch (error) {
|
|
104
|
+
callback(error);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
this
|
|
108
|
+
onInputFinished(callback) {
|
|
109
|
+
this.streamEnded = true;
|
|
110
110
|
try {
|
|
111
|
-
this
|
|
112
|
-
if (this
|
|
111
|
+
this.processChunkData();
|
|
112
|
+
if (this.verbose) {
|
|
113
113
|
console.log('---------------');
|
|
114
|
-
console.log('implode: total number of chunks read:', this
|
|
115
|
-
console.log('implode: inputBuffer heap size',
|
|
116
|
-
console.log('implode: outputBuffer heap size',
|
|
114
|
+
console.log('implode: total number of chunks read:', this.stats.chunkCounter);
|
|
115
|
+
console.log('implode: inputBuffer heap size', toHex(this.inputBuffer.heapSize()));
|
|
116
|
+
console.log('implode: outputBuffer heap size', toHex(this.outputBuffer.heapSize()));
|
|
117
117
|
}
|
|
118
|
-
callback(null, this
|
|
118
|
+
callback(null, this.outputBuffer.read());
|
|
119
119
|
}
|
|
120
|
-
catch (
|
|
121
|
-
callback(
|
|
120
|
+
catch (error) {
|
|
121
|
+
callback(error);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
if (this
|
|
126
|
-
this
|
|
124
|
+
processChunkData() {
|
|
125
|
+
if (this.dictionarySizeMask === -1) {
|
|
126
|
+
this.setup();
|
|
127
127
|
}
|
|
128
|
-
if (!this
|
|
129
|
-
this
|
|
130
|
-
if (!this
|
|
131
|
-
if (this
|
|
128
|
+
if (!this.inputBuffer.isEmpty()) {
|
|
129
|
+
this.startIndex = 0;
|
|
130
|
+
if (!this.handledFirstTwoBytes) {
|
|
131
|
+
if (this.inputBuffer.size() < 3) {
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
this
|
|
135
|
-
this
|
|
134
|
+
this.handledFirstTwoBytes = true;
|
|
135
|
+
this.handleFirstTwoBytes();
|
|
136
136
|
}
|
|
137
137
|
// -------------------------------
|
|
138
|
+
// eslint-disable-next-line prefer-const -- this might get overriden while searching for repetitions
|
|
138
139
|
let endOfLastMatch = 0; // used when searching for longer repetitions later
|
|
139
|
-
while (this
|
|
140
|
-
|
|
141
|
-
let
|
|
140
|
+
while (this.startIndex < this.inputBuffer.size()) {
|
|
141
|
+
// eslint-disable-next-line prefer-const -- this might get overriden while searching for repetitions
|
|
142
|
+
let { size, distance } = findRepetitions(this.inputBuffer.read(endOfLastMatch), endOfLastMatch, this.startIndex);
|
|
143
|
+
// eslint-disable-next-line prefer-const -- this might get overriden while searching for repetitions
|
|
144
|
+
let isFlushable = this.isRepetitionFlushable(size, distance);
|
|
142
145
|
if (isFlushable === false) {
|
|
143
|
-
const byte = this
|
|
144
|
-
this
|
|
145
|
-
this
|
|
146
|
+
const byte = this.inputBuffer.readByte(this.startIndex);
|
|
147
|
+
this.outputBits(this.nChBits[byte], this.nChCodes[byte]);
|
|
148
|
+
this.startIndex = this.startIndex + 1;
|
|
146
149
|
}
|
|
147
150
|
else {
|
|
148
151
|
if (isFlushable === null) {
|
|
149
152
|
/*
|
|
150
153
|
// Try to find better repetition 1 byte later.
|
|
151
154
|
// stormlib/implode.c L517
|
|
152
|
-
let cursor = this
|
|
155
|
+
let cursor = this.startIndex
|
|
153
156
|
let newSize = size
|
|
154
157
|
let newDistance = distance
|
|
155
158
|
let currentSize
|
|
156
159
|
let currentDistance
|
|
157
|
-
while (newSize <= currentSize && this
|
|
160
|
+
while (newSize <= currentSize && this.isRepetitionFlushable(newSize, newDistance)) {
|
|
158
161
|
currentSize = newSize
|
|
159
162
|
currentDistance = newDistance
|
|
160
|
-
const reps = findRepetitions(this
|
|
163
|
+
const reps = findRepetitions(this.inputBuffer.read(endOfLastMatch), endOfLastMatch, ++cursor)
|
|
161
164
|
newSize = reps.size
|
|
162
165
|
newDistance = reps.distance
|
|
163
166
|
}
|
|
@@ -166,44 +169,44 @@ class Implode {
|
|
|
166
169
|
*/
|
|
167
170
|
}
|
|
168
171
|
const byte = size + 0xfe;
|
|
169
|
-
this
|
|
172
|
+
this.outputBits(this.nChBits[byte], this.nChCodes[byte]);
|
|
170
173
|
if (size === 2) {
|
|
171
174
|
const byte = distance >> 2;
|
|
172
|
-
this
|
|
173
|
-
this
|
|
175
|
+
this.outputBits(this.distBits[byte], this.distCodes[byte]);
|
|
176
|
+
this.outputBits(2, distance & 3);
|
|
174
177
|
}
|
|
175
178
|
else {
|
|
176
|
-
const byte = distance >> this
|
|
177
|
-
this
|
|
178
|
-
this
|
|
179
|
+
const byte = distance >> this.dictionarySize;
|
|
180
|
+
this.outputBits(this.distBits[byte], this.distCodes[byte]);
|
|
181
|
+
this.outputBits(this.dictionarySize, this.dictionarySizeMask & distance);
|
|
179
182
|
}
|
|
180
|
-
this
|
|
183
|
+
this.startIndex = this.startIndex + size;
|
|
181
184
|
}
|
|
182
185
|
/*
|
|
183
|
-
this
|
|
184
|
-
this
|
|
186
|
+
this.inputBuffer.dropStart(endOfLastMatch)
|
|
187
|
+
this.startIndex -= endOfLastMatch
|
|
185
188
|
endOfLastMatch = 0
|
|
186
189
|
*/
|
|
187
|
-
if (this
|
|
188
|
-
this
|
|
189
|
-
this
|
|
190
|
+
if (this.dictionarySize === DictionarySize.Small && this.startIndex >= 0x4_00) {
|
|
191
|
+
this.inputBuffer.dropStart(0x4_00);
|
|
192
|
+
this.startIndex = this.startIndex - 0x4_00;
|
|
190
193
|
}
|
|
191
|
-
else if (this
|
|
192
|
-
this
|
|
193
|
-
this
|
|
194
|
+
else if (this.dictionarySize === DictionarySize.Medium && this.startIndex >= 0x8_00) {
|
|
195
|
+
this.inputBuffer.dropStart(0x8_00);
|
|
196
|
+
this.startIndex = this.startIndex - 0x8_00;
|
|
194
197
|
}
|
|
195
|
-
else if (this
|
|
196
|
-
this
|
|
197
|
-
this
|
|
198
|
+
else if (this.dictionarySize === DictionarySize.Large && this.startIndex >= 0x10_00) {
|
|
199
|
+
this.inputBuffer.dropStart(0x10_00);
|
|
200
|
+
this.startIndex = this.startIndex - 0x10_00;
|
|
198
201
|
}
|
|
199
202
|
}
|
|
200
203
|
// -------------------------------
|
|
201
|
-
// this
|
|
202
|
-
this
|
|
204
|
+
// this.inputBuffer.dropStart(this.inputBuffer.size())
|
|
205
|
+
this.inputBuffer.clear();
|
|
203
206
|
}
|
|
204
|
-
if (this
|
|
207
|
+
if (this.streamEnded) {
|
|
205
208
|
// Write the termination literal
|
|
206
|
-
this
|
|
209
|
+
this.outputBits(this.nChBits.at(-1), this.nChCodes.at(-1));
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
/**
|
|
@@ -211,17 +214,17 @@ class Implode {
|
|
|
211
214
|
* @returns true - flushable
|
|
212
215
|
* @returns null - flushable, but there might be a better repetition
|
|
213
216
|
*/
|
|
214
|
-
|
|
217
|
+
isRepetitionFlushable(size, distance) {
|
|
215
218
|
if (size === 0) {
|
|
216
219
|
return false;
|
|
217
220
|
}
|
|
218
221
|
// If we found repetition of 2 bytes, that is 0x100 or further back,
|
|
219
222
|
// don't bother. Storing the distance of 0x100 bytes would actually
|
|
220
223
|
// take more space than storing the 2 bytes as-is.
|
|
221
|
-
if (size === 2 && distance >=
|
|
224
|
+
if (size === 2 && distance >= 0x1_00) {
|
|
222
225
|
return false;
|
|
223
226
|
}
|
|
224
|
-
if (size >= 8 || this
|
|
227
|
+
if (size >= 8 || this.startIndex + 1 >= this.inputBuffer.size()) {
|
|
225
228
|
return true;
|
|
226
229
|
}
|
|
227
230
|
return null;
|
|
@@ -230,76 +233,80 @@ class Implode {
|
|
|
230
233
|
* repetitions are at least 2 bytes long,
|
|
231
234
|
* so the initial 2 bytes can be moved to the output as is
|
|
232
235
|
*/
|
|
233
|
-
|
|
234
|
-
const byte1 = this
|
|
235
|
-
const byte2 = this
|
|
236
|
-
this
|
|
237
|
-
this
|
|
238
|
-
this
|
|
236
|
+
handleFirstTwoBytes() {
|
|
237
|
+
const byte1 = this.inputBuffer.readByte(0);
|
|
238
|
+
const byte2 = this.inputBuffer.readByte(1);
|
|
239
|
+
this.outputBits(this.nChBits[byte1], this.nChCodes[byte1]);
|
|
240
|
+
this.outputBits(this.nChBits[byte2], this.nChCodes[byte2]);
|
|
241
|
+
this.startIndex = this.startIndex + 2;
|
|
239
242
|
}
|
|
240
|
-
|
|
241
|
-
switch (this
|
|
242
|
-
case
|
|
243
|
-
this
|
|
243
|
+
setup() {
|
|
244
|
+
switch (this.dictionarySize) {
|
|
245
|
+
case DictionarySize.Large: {
|
|
246
|
+
this.dictionarySizeMask = nBitsOfOnes(6);
|
|
244
247
|
break;
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
}
|
|
249
|
+
case DictionarySize.Medium: {
|
|
250
|
+
this.dictionarySizeMask = nBitsOfOnes(5);
|
|
247
251
|
break;
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
}
|
|
253
|
+
case DictionarySize.Small: {
|
|
254
|
+
this.dictionarySizeMask = nBitsOfOnes(4);
|
|
250
255
|
break;
|
|
256
|
+
}
|
|
251
257
|
}
|
|
252
|
-
switch (this
|
|
253
|
-
case
|
|
258
|
+
switch (this.compressionType) {
|
|
259
|
+
case Compression.Binary: {
|
|
254
260
|
let nChCode = 0;
|
|
255
|
-
for (let nCount = 0; nCount <
|
|
256
|
-
this
|
|
257
|
-
this
|
|
258
|
-
nChCode =
|
|
261
|
+
for (let nCount = 0; nCount < 0x1_00; nCount++) {
|
|
262
|
+
this.nChBits[nCount] = 9;
|
|
263
|
+
this.nChCodes[nCount] = nChCode;
|
|
264
|
+
nChCode = getLowestNBits(16, nChCode) + 2;
|
|
259
265
|
}
|
|
260
266
|
break;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
this
|
|
267
|
+
}
|
|
268
|
+
case Compression.Ascii: {
|
|
269
|
+
for (let nCount = 0; nCount < 0x1_00; nCount++) {
|
|
270
|
+
this.nChBits[nCount] = ChBitsAsc[nCount] + 1;
|
|
271
|
+
this.nChCodes[nCount] = ChCodeAsc[nCount] * 2;
|
|
265
272
|
}
|
|
266
273
|
break;
|
|
274
|
+
}
|
|
267
275
|
}
|
|
268
|
-
let nCount =
|
|
276
|
+
let nCount = 0x1_00;
|
|
269
277
|
for (let i = 0; i < 0x10; i++) {
|
|
270
|
-
for (let nCount2 = 0; nCount2 < 1 <<
|
|
271
|
-
this
|
|
272
|
-
this
|
|
278
|
+
for (let nCount2 = 0; nCount2 < 1 << ExLenBits[i]; nCount2++) {
|
|
279
|
+
this.nChBits[nCount] = ExLenBits[i] + LenBits[i] + 1;
|
|
280
|
+
this.nChCodes[nCount] = (nCount2 << (LenBits[i] + 1)) | (LenCode[i] * 2) | 1;
|
|
273
281
|
nCount++;
|
|
274
282
|
}
|
|
275
283
|
}
|
|
276
|
-
this
|
|
277
|
-
this
|
|
278
|
-
this
|
|
279
|
-
this
|
|
284
|
+
this.outputBuffer.appendByte(this.compressionType);
|
|
285
|
+
this.outputBuffer.appendByte(this.dictionarySize);
|
|
286
|
+
this.outputBuffer.appendByte(0);
|
|
287
|
+
this.outBits = 0;
|
|
280
288
|
}
|
|
281
|
-
|
|
289
|
+
outputBits(nBits, bitBuffer) {
|
|
282
290
|
if (nBits > 8) {
|
|
283
|
-
this
|
|
291
|
+
this.outputBits(8, bitBuffer);
|
|
284
292
|
bitBuffer = bitBuffer >> 8;
|
|
285
293
|
nBits = nBits - 8;
|
|
286
294
|
}
|
|
287
|
-
const outBits = this
|
|
288
|
-
const lastBytes = this
|
|
289
|
-
this
|
|
290
|
-
this
|
|
291
|
-
if (this
|
|
292
|
-
this
|
|
295
|
+
const { outBits } = this;
|
|
296
|
+
const lastBytes = this.outputBuffer.readByte(this.outputBuffer.size() - 1);
|
|
297
|
+
this.outputBuffer.setByte(-1, lastBytes | getLowestNBits(8, bitBuffer << outBits));
|
|
298
|
+
this.outBits = this.outBits + nBits;
|
|
299
|
+
if (this.outBits > 8) {
|
|
300
|
+
this.outBits = getLowestNBits(3, this.outBits);
|
|
293
301
|
bitBuffer = bitBuffer >> (8 - outBits);
|
|
294
|
-
this
|
|
302
|
+
this.outputBuffer.appendByte(getLowestNBits(8, bitBuffer));
|
|
295
303
|
}
|
|
296
304
|
else {
|
|
297
|
-
this
|
|
298
|
-
if (this
|
|
299
|
-
this
|
|
305
|
+
this.outBits = getLowestNBits(3, this.outBits);
|
|
306
|
+
if (this.outBits === 0) {
|
|
307
|
+
this.outputBuffer.appendByte(0);
|
|
300
308
|
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
|
-
exports.Implode = Implode;
|
|
305
312
|
//# sourceMappingURL=Implode.js.map
|
package/dist/Implode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Implode.js","sourceRoot":"","sources":["../src/Implode.ts"],"names":[],"mappings":";;;AAAA,6CAAoC;AAEpC,2CAYoB;AACpB,qCAAkF;AAClF,uDAAmD;AACnD,2CAA8G;AAGvG,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE;IAC5E,MAAM,KAAK,GAAG,IAAA,iBAAK,EAAC,CAAC,EAAE,sCAA0B,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAEzD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE;QAC/B,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;YAC3C,OAAO,CAAC,CAAA;SACT;KACF;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAVY,QAAA,iBAAiB,qBA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,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YAC9C,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;gBACvB,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/bin/explode.js
CHANGED
|
@@ -1,59 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --enable-source-maps
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const
|
|
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), {
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import minimist from 'minimist-lite';
|
|
4
|
+
import { transformEmpty, transformIdentity, transformSplitBy, splitAt, through } from '../stream.js';
|
|
5
|
+
import { explode } from '../index.js';
|
|
6
|
+
import { getPackageVersion, parseNumberString, getInputStream, getOutputStream } from './helpers.js';
|
|
7
|
+
const args = minimist(process.argv.slice(2), {
|
|
12
8
|
string: ['output', 'offset', 'input-buffer-size', 'output-buffer-size'],
|
|
13
9
|
boolean: ['version', 'drop-before-offset', 'verbose'],
|
|
14
10
|
alias: {
|
|
15
11
|
v: 'version',
|
|
16
12
|
},
|
|
17
13
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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);
|
|
14
|
+
async function decompress(input, output, offset, keepHeader, config) {
|
|
15
|
+
let leftHandler;
|
|
16
|
+
if (keepHeader) {
|
|
17
|
+
leftHandler = transformIdentity();
|
|
31
18
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
input = await (0, helpers_1.getInputStream)(args._[0]);
|
|
36
|
-
output = await (0, helpers_1.getOutputStream)(args.output);
|
|
19
|
+
else {
|
|
20
|
+
leftHandler = transformEmpty();
|
|
37
21
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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);
|
|
22
|
+
const rightHandler = explode(config);
|
|
23
|
+
const handler = transformSplitBy(splitAt(offset), leftHandler, rightHandler);
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
input.pipe(through(handler).on('error', reject)).pipe(output).on('finish', resolve).on('error', reject);
|
|
57
26
|
});
|
|
58
|
-
}
|
|
27
|
+
}
|
|
28
|
+
if (args.version) {
|
|
29
|
+
const version = await getPackageVersion();
|
|
30
|
+
console.log(`node-pkware - version ${version}`);
|
|
31
|
+
process.exit(0);
|
|
32
|
+
}
|
|
33
|
+
let input;
|
|
34
|
+
let output;
|
|
35
|
+
try {
|
|
36
|
+
input = await getInputStream(args._[0]);
|
|
37
|
+
output = await getOutputStream(args.output);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('error:', error.message);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
const offset = parseNumberString(args.offset, 0);
|
|
44
|
+
const keepHeader = !args['drop-before-offset'];
|
|
45
|
+
const config = {
|
|
46
|
+
verbose: args.verbose,
|
|
47
|
+
inputBufferSize: parseNumberString(args['input-buffer-size'], 0x1_00_00),
|
|
48
|
+
outputBufferSize: parseNumberString(args['output-buffer-size'], 0x4_00_00),
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
await decompress(input, output, offset, keepHeader, config);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.error('error:', error.message);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
59
58
|
//# sourceMappingURL=explode.js.map
|