@gmod/cram 6.0.0 → 7.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.
- package/dist/craiIndex.js +2 -2
- package/dist/craiIndex.js.map +1 -1
- package/dist/cram-bundle.js +1 -1
- package/dist/cramFile/file.d.ts +2 -2
- package/dist/cramFile/file.js +9 -13
- package/dist/cramFile/file.js.map +1 -1
- package/dist/htscodecs/index.d.ts +1 -5
- package/dist/htscodecs/index.js +11 -72
- package/dist/htscodecs/index.js.map +1 -1
- package/dist/htscodecs-wasm.d.ts +7 -0
- package/dist/htscodecs-wasm.js +183 -0
- package/dist/htscodecs-wasm.js.map +1 -0
- package/dist/unzip.d.ts +1 -1
- package/dist/unzip.js +3 -3
- package/dist/unzip.js.map +1 -1
- package/dist/wasm/htscodecs.d.ts +5 -0
- package/dist/wasm/htscodecs.js +0 -0
- package/dist/wasm/htscodecs.js.map +1 -0
- package/esm/craiIndex.js +2 -2
- package/esm/craiIndex.js.map +1 -1
- package/esm/cramFile/file.d.ts +2 -2
- package/esm/cramFile/file.js +7 -11
- package/esm/cramFile/file.js.map +1 -1
- package/esm/htscodecs/index.d.ts +1 -5
- package/esm/htscodecs/index.js +3 -31
- package/esm/htscodecs/index.js.map +1 -1
- package/esm/htscodecs-wasm.d.ts +7 -0
- package/esm/htscodecs-wasm.js +171 -0
- package/esm/htscodecs-wasm.js.map +1 -0
- package/esm/unzip.d.ts +1 -1
- package/esm/unzip.js +3 -3
- package/esm/unzip.js.map +1 -1
- package/esm/wasm/htscodecs.d.ts +5 -0
- package/esm/wasm/htscodecs.js +0 -0
- package/esm/wasm/htscodecs.js.map +1 -0
- package/package.json +9 -9
- package/src/craiIndex.ts +4 -2
- package/src/cramFile/file.ts +7 -11
- package/src/htscodecs/index.ts +12 -38
- package/src/htscodecs-wasm.ts +210 -0
- package/src/unzip.ts +3 -3
- package/src/wasm/htscodecs.d.ts +58 -0
- package/src/wasm/htscodecs.js +0 -0
- package/dist/htscodecs/arith_gen.d.ts +0 -16
- package/dist/htscodecs/arith_gen.js +0 -323
- package/dist/htscodecs/arith_gen.js.map +0 -1
- package/dist/htscodecs/arith_sh.d.ts +0 -9
- package/dist/htscodecs/arith_sh.js +0 -134
- package/dist/htscodecs/arith_sh.js.map +0 -1
- package/dist/htscodecs/byte_model.d.ts +0 -6
- package/dist/htscodecs/byte_model.js +0 -121
- package/dist/htscodecs/byte_model.js.map +0 -1
- package/dist/htscodecs/fqzcomp.d.ts +0 -1
- package/dist/htscodecs/fqzcomp.js +0 -346
- package/dist/htscodecs/fqzcomp.js.map +0 -1
- package/dist/htscodecs/iostream.d.ts +0 -16
- package/dist/htscodecs/iostream.js +0 -148
- package/dist/htscodecs/iostream.js.map +0 -1
- package/dist/htscodecs/rans.d.ts +0 -1
- package/dist/htscodecs/rans.js +0 -224
- package/dist/htscodecs/rans.js.map +0 -1
- package/dist/htscodecs/rans4x16.d.ts +0 -1
- package/dist/htscodecs/rans4x16.js +0 -445
- package/dist/htscodecs/rans4x16.js.map +0 -1
- package/dist/htscodecs/tok3.d.ts +0 -1
- package/dist/htscodecs/tok3.js +0 -206
- package/dist/htscodecs/tok3.js.map +0 -1
- package/dist/rans/constants.d.ts +0 -4
- package/dist/rans/constants.js +0 -10
- package/dist/rans/constants.js.map +0 -1
- package/dist/rans/d04.d.ts +0 -1
- package/dist/rans/d04.js +0 -100
- package/dist/rans/d04.js.map +0 -1
- package/dist/rans/d14.d.ts +0 -1
- package/dist/rans/d14.js +0 -96
- package/dist/rans/d14.js.map +0 -1
- package/dist/rans/decoding.d.ts +0 -27
- package/dist/rans/decoding.js +0 -119
- package/dist/rans/decoding.js.map +0 -1
- package/dist/rans/frequencies.d.ts +0 -2
- package/dist/rans/frequencies.js +0 -112
- package/dist/rans/frequencies.js.map +0 -1
- package/dist/rans/index.d.ts +0 -1
- package/dist/rans/index.js +0 -198
- package/dist/rans/index.js.map +0 -1
- package/dist/seek-bzip/bitreader.d.ts +0 -27
- package/dist/seek-bzip/bitreader.js +0 -101
- package/dist/seek-bzip/bitreader.js.map +0 -1
- package/dist/seek-bzip/crc32.d.ts +0 -26
- package/dist/seek-bzip/crc32.js +0 -115
- package/dist/seek-bzip/crc32.js.map +0 -1
- package/dist/seek-bzip/index.d.ts +0 -9
- package/dist/seek-bzip/index.js +0 -585
- package/dist/seek-bzip/index.js.map +0 -1
- package/dist/seek-bzip/stream.d.ts +0 -8
- package/dist/seek-bzip/stream.js +0 -37
- package/dist/seek-bzip/stream.js.map +0 -1
- package/dist/seek-bzip/toHex.d.ts +0 -1
- package/dist/seek-bzip/toHex.js +0 -36
- package/dist/seek-bzip/toHex.js.map +0 -1
- package/esm/htscodecs/arith_gen.d.ts +0 -16
- package/esm/htscodecs/arith_gen.js +0 -317
- package/esm/htscodecs/arith_gen.js.map +0 -1
- package/esm/htscodecs/arith_sh.d.ts +0 -9
- package/esm/htscodecs/arith_sh.js +0 -131
- package/esm/htscodecs/arith_sh.js.map +0 -1
- package/esm/htscodecs/byte_model.d.ts +0 -6
- package/esm/htscodecs/byte_model.js +0 -118
- package/esm/htscodecs/byte_model.js.map +0 -1
- package/esm/htscodecs/fqzcomp.d.ts +0 -1
- package/esm/htscodecs/fqzcomp.js +0 -340
- package/esm/htscodecs/fqzcomp.js.map +0 -1
- package/esm/htscodecs/iostream.d.ts +0 -16
- package/esm/htscodecs/iostream.js +0 -145
- package/esm/htscodecs/iostream.js.map +0 -1
- package/esm/htscodecs/rans.d.ts +0 -1
- package/esm/htscodecs/rans.js +0 -218
- package/esm/htscodecs/rans.js.map +0 -1
- package/esm/htscodecs/rans4x16.d.ts +0 -1
- package/esm/htscodecs/rans4x16.js +0 -439
- package/esm/htscodecs/rans4x16.js.map +0 -1
- package/esm/htscodecs/tok3.d.ts +0 -1
- package/esm/htscodecs/tok3.js +0 -167
- package/esm/htscodecs/tok3.js.map +0 -1
- package/esm/rans/constants.d.ts +0 -4
- package/esm/rans/constants.js +0 -5
- package/esm/rans/constants.js.map +0 -1
- package/esm/rans/d04.d.ts +0 -1
- package/esm/rans/d04.js +0 -94
- package/esm/rans/d04.js.map +0 -1
- package/esm/rans/d14.d.ts +0 -1
- package/esm/rans/d14.js +0 -93
- package/esm/rans/d14.js.map +0 -1
- package/esm/rans/decoding.d.ts +0 -27
- package/esm/rans/decoding.js +0 -117
- package/esm/rans/decoding.js.map +0 -1
- package/esm/rans/frequencies.d.ts +0 -2
- package/esm/rans/frequencies.js +0 -105
- package/esm/rans/frequencies.js.map +0 -1
- package/esm/rans/index.d.ts +0 -1
- package/esm/rans/index.js +0 -192
- package/esm/rans/index.js.map +0 -1
- package/esm/seek-bzip/bitreader.d.ts +0 -27
- package/esm/seek-bzip/bitreader.js +0 -98
- package/esm/seek-bzip/bitreader.js.map +0 -1
- package/esm/seek-bzip/crc32.d.ts +0 -26
- package/esm/seek-bzip/crc32.js +0 -112
- package/esm/seek-bzip/crc32.js.map +0 -1
- package/esm/seek-bzip/index.d.ts +0 -9
- package/esm/seek-bzip/index.js +0 -579
- package/esm/seek-bzip/index.js.map +0 -1
- package/esm/seek-bzip/stream.d.ts +0 -8
- package/esm/seek-bzip/stream.js +0 -34
- package/esm/seek-bzip/stream.js.map +0 -1
- package/esm/seek-bzip/toHex.d.ts +0 -1
- package/esm/seek-bzip/toHex.js +0 -33
- package/esm/seek-bzip/toHex.js.map +0 -1
- package/src/htscodecs/arith_gen.ts +0 -371
- package/src/htscodecs/arith_sh.ts +0 -146
- package/src/htscodecs/byte_model.ts +0 -136
- package/src/htscodecs/fqzcomp.ts +0 -394
- package/src/htscodecs/iostream.ts +0 -159
- package/src/htscodecs/rans.ts +0 -250
- package/src/htscodecs/rans4x16.ts +0 -521
- package/src/htscodecs/tok3.ts +0 -197
- package/src/rans/README.md +0 -1
- package/src/rans/constants.ts +0 -5
- package/src/rans/d04.ts +0 -112
- package/src/rans/d14.ts +0 -106
- package/src/rans/decoding.ts +0 -138
- package/src/rans/frequencies.ts +0 -115
- package/src/rans/index.ts +0 -245
- package/src/seek-bzip/README.md +0 -6
- package/src/seek-bzip/bitreader.ts +0 -113
- package/src/seek-bzip/crc32.ts +0 -121
- package/src/seek-bzip/index.ts +0 -615
- package/src/seek-bzip/stream.ts +0 -33
- package/src/seek-bzip/toHex.ts +0 -33
package/dist/rans/index.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
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.default = uncompress;
|
|
7
|
-
// @ts-nocheck
|
|
8
|
-
const errors_ts_1 = require("../errors.js");
|
|
9
|
-
const d04_ts_1 = __importDefault(require("./d04.js"));
|
|
10
|
-
const d14_ts_1 = __importDefault(require("./d14.js"));
|
|
11
|
-
const decoding_ts_1 = __importDefault(require("./decoding.js"));
|
|
12
|
-
const frequencies_ts_1 = require("./frequencies.js");
|
|
13
|
-
// const /* int */ ORDER_BYTE_LENGTH = 1
|
|
14
|
-
// const /* int */ COMPRESSED_BYTE_LENGTH = 4
|
|
15
|
-
const /* int */ RAW_BYTE_LENGTH = 4;
|
|
16
|
-
// const /* int */ PREFIX_BYTE_LENGTH =
|
|
17
|
-
// ORDER_BYTE_LENGTH + COMPRESSED_BYTE_LENGTH + RAW_BYTE_LENGTH
|
|
18
|
-
// enum ORDER {
|
|
19
|
-
// ZERO, ONE;
|
|
20
|
-
// static ORDER fromInt(const /* int */ value) {
|
|
21
|
-
// try {
|
|
22
|
-
// return ORDER.values()[value];
|
|
23
|
-
// } catch (const ArrayIndexOutOfBoundsException e) {
|
|
24
|
-
// throw new RuntimeException("Unknown rANS order: " + value);
|
|
25
|
-
// }
|
|
26
|
-
// }
|
|
27
|
-
// }
|
|
28
|
-
// static ByteBuffer compress(const ByteBuffer input, const ORDER order, const ByteBuffer out) {
|
|
29
|
-
// if (input.remaining() == 0)
|
|
30
|
-
// return EMPTY_BUFFER;
|
|
31
|
-
// if (input.remaining() < 4)
|
|
32
|
-
// return encode_order0_way4(input, out);
|
|
33
|
-
// switch (order) {
|
|
34
|
-
// case ZERO:
|
|
35
|
-
// return encode_order0_way4(input, out);
|
|
36
|
-
// case ONE:
|
|
37
|
-
// return encode_order1_way4(input, out);
|
|
38
|
-
// default:
|
|
39
|
-
// throw new RuntimeException("Unknown rANS order: " + order);
|
|
40
|
-
// }
|
|
41
|
-
// }
|
|
42
|
-
// static /* ByteBuffer */ allocateIfNeeded(/* const int */ in_size,
|
|
43
|
-
// /* const ByteBuffer */ out_buf) {
|
|
44
|
-
// const /* int */ compressedSize = (/* int */) (1.05 * in_size + 257 * 257 * 3 + 4);
|
|
45
|
-
// if (out_buf == null)
|
|
46
|
-
// return ByteBuffer.allocate(compressedSize);
|
|
47
|
-
// if (out_buf.remaining() < compressedSize)
|
|
48
|
-
// throw new RuntimeException("Insufficient buffer size.");
|
|
49
|
-
// out_buf.order(ByteOrder.LITTLE_ENDIAN);
|
|
50
|
-
// return out_buf;
|
|
51
|
-
// }
|
|
52
|
-
// static ByteBuffer encode_order0_way4(const ByteBuffer input,
|
|
53
|
-
// ByteBuffer out_buf) {
|
|
54
|
-
// const /* int */ in_size = input.remaining();
|
|
55
|
-
// out_buf = allocateIfNeeded(in_size, out_buf);
|
|
56
|
-
// const /* int */ freqTableStart = PREFIX_BYTE_LENGTH;
|
|
57
|
-
// out_buf.position(freqTableStart);
|
|
58
|
-
// const /* int */[] F = Frequencies.calcFrequencies_o0(in);
|
|
59
|
-
// const RansEncSymbol[] syms = Frequencies.buildSyms_o0(F);
|
|
60
|
-
// const ByteBuffer cp = out_buf.slice();
|
|
61
|
-
// const /* int */ frequencyTable_size = Frequencies.writeFrequencies_o0(cp, F);
|
|
62
|
-
// input.rewind();
|
|
63
|
-
// const /* int */ compressedBlob_size = E04.compress(input, syms, cp);
|
|
64
|
-
// finalizeCompressed(0, out_buf, in_size, frequencyTable_size,
|
|
65
|
-
// compressedBlob_size);
|
|
66
|
-
// return out_buf;
|
|
67
|
-
// }
|
|
68
|
-
// static ByteBuffer encode_order1_way4(const ByteBuffer input,
|
|
69
|
-
// ByteBuffer out_buf) {
|
|
70
|
-
// const /* int */ in_size = input.remaining();
|
|
71
|
-
// out_buf = allocateIfNeeded(in_size, out_buf);
|
|
72
|
-
// const /* int */ freqTableStart = PREFIX_BYTE_LENGTH;
|
|
73
|
-
// out_buf.position(freqTableStart);
|
|
74
|
-
// const /* int */[][] F = Frequencies.calcFrequencies_o1(in);
|
|
75
|
-
// const RansEncSymbol[][] syms = Frequencies.buildSyms_o1(F);
|
|
76
|
-
// const ByteBuffer cp = out_buf.slice();
|
|
77
|
-
// const /* int */ frequencyTable_size = Frequencies.writeFrequencies_o1(cp, F);
|
|
78
|
-
// input.rewind();
|
|
79
|
-
// const /* int */ compressedBlob_size = E14.compress(input, syms, cp);
|
|
80
|
-
// finalizeCompressed(1, out_buf, in_size, frequencyTable_size,
|
|
81
|
-
// compressedBlob_size);
|
|
82
|
-
// return out_buf;
|
|
83
|
-
// }
|
|
84
|
-
// static void finalizeCompressed(const /* int */ order, const ByteBuffer out_buf,
|
|
85
|
-
// const /* int */ in_size, const /* int */ frequencyTable_size, const /* int */ compressedBlob_size) {
|
|
86
|
-
// out_buf.limit(PREFIX_BYTE_LENGTH + frequencyTable_size
|
|
87
|
-
// + compressedBlob_size);
|
|
88
|
-
// out_buf.put(0, (byte) order);
|
|
89
|
-
// out_buf.order(ByteOrder.LITTLE_ENDIAN);
|
|
90
|
-
// const /* int */ compressedSizeOffset = ORDER_BYTE_LENGTH;
|
|
91
|
-
// out_buf.putInt(compressedSizeOffset, frequencyTable_size
|
|
92
|
-
// + compressedBlob_size);
|
|
93
|
-
// const /* int */ rawSizeOffset = ORDER_BYTE_LENGTH + COMPRESSED_BYTE_LENGTH;
|
|
94
|
-
// out_buf.putInt(rawSizeOffset, in_size);
|
|
95
|
-
// out_buf.rewind();
|
|
96
|
-
// }
|
|
97
|
-
function uncompressOrder0Way4(
|
|
98
|
-
/* const ByteBuffer */ input,
|
|
99
|
-
/* const ByteBuffer */ out) {
|
|
100
|
-
// input.order(ByteOrder.LITTLE_ENDIAN);
|
|
101
|
-
const D = new decoding_ts_1.default.AriDecoder();
|
|
102
|
-
const syms = new Array(256);
|
|
103
|
-
for (let i = 0; i < 256; i += 1) {
|
|
104
|
-
syms[i] = new decoding_ts_1.default.DecodingSymbol();
|
|
105
|
-
}
|
|
106
|
-
(0, frequencies_ts_1.readStatsO0)(input, D, syms);
|
|
107
|
-
(0, d04_ts_1.default)(input, D, syms, out);
|
|
108
|
-
return out;
|
|
109
|
-
}
|
|
110
|
-
function uncompressOrder1Way4(
|
|
111
|
-
/* const ByteBuffer */ input,
|
|
112
|
-
/* const ByteBuffer */ output) {
|
|
113
|
-
const D = new Array(256);
|
|
114
|
-
for (let i = 0; i < 256; i += 1) {
|
|
115
|
-
D[i] = new decoding_ts_1.default.AriDecoder();
|
|
116
|
-
}
|
|
117
|
-
const syms = new Array(256);
|
|
118
|
-
for (let i = 0; i < 256; i += 1) {
|
|
119
|
-
syms[i] = new Array(256);
|
|
120
|
-
for (let j = 0; j < 256; j += 1) {
|
|
121
|
-
syms[i][j] = new decoding_ts_1.default.DecodingSymbol();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
(0, frequencies_ts_1.readStatsO1)(input, D, syms);
|
|
125
|
-
(0, d14_ts_1.default)(input, output, D, syms);
|
|
126
|
-
return output;
|
|
127
|
-
}
|
|
128
|
-
/* compat layer to make a node buffer act like a java ByteBuffer */
|
|
129
|
-
class ByteBuffer {
|
|
130
|
-
constructor(nodeBuffer, initialInputPosition = 0) {
|
|
131
|
-
this._buffer = nodeBuffer;
|
|
132
|
-
this._dataView = new DataView(nodeBuffer.buffer);
|
|
133
|
-
this._position = initialInputPosition;
|
|
134
|
-
this.length = nodeBuffer.length;
|
|
135
|
-
}
|
|
136
|
-
get() {
|
|
137
|
-
return this._buffer[this._position++];
|
|
138
|
-
}
|
|
139
|
-
getByte() {
|
|
140
|
-
return this._buffer[this._position++];
|
|
141
|
-
}
|
|
142
|
-
getByteAt(position) {
|
|
143
|
-
return this._buffer[position];
|
|
144
|
-
}
|
|
145
|
-
position() {
|
|
146
|
-
return this._position;
|
|
147
|
-
}
|
|
148
|
-
put(val) {
|
|
149
|
-
this._buffer[this._position++] = val;
|
|
150
|
-
}
|
|
151
|
-
putAt(position, val) {
|
|
152
|
-
this._buffer[position] = val;
|
|
153
|
-
}
|
|
154
|
-
setPosition(pos) {
|
|
155
|
-
this._position = pos;
|
|
156
|
-
return pos;
|
|
157
|
-
}
|
|
158
|
-
getInt() {
|
|
159
|
-
const i = this._dataView.getInt32(this._position, true);
|
|
160
|
-
this._position += 4;
|
|
161
|
-
return i;
|
|
162
|
-
}
|
|
163
|
-
remaining() {
|
|
164
|
-
return this.length - this._position;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// static /* const */ ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
|
|
168
|
-
function uncompress(inputBuffer, outputBuffer, initialInputPosition = 0) {
|
|
169
|
-
if (inputBuffer.length === 0) {
|
|
170
|
-
outputBuffer.fill(0);
|
|
171
|
-
return outputBuffer;
|
|
172
|
-
}
|
|
173
|
-
const input = new ByteBuffer(inputBuffer, initialInputPosition);
|
|
174
|
-
// input.order(ByteOrder.LITTLE_ENDIAN);
|
|
175
|
-
const order = input.get();
|
|
176
|
-
if (order !== 0 && order !== 1) {
|
|
177
|
-
throw new errors_ts_1.CramMalformedError(`Invalid rANS order ${order}`);
|
|
178
|
-
}
|
|
179
|
-
const /* int */ inputSize = input.getInt();
|
|
180
|
-
if (inputSize !== input.remaining() - RAW_BYTE_LENGTH) {
|
|
181
|
-
throw new errors_ts_1.CramMalformedError('Incorrect input length.');
|
|
182
|
-
}
|
|
183
|
-
const /* int */ outputSize = input.getInt();
|
|
184
|
-
const output = new ByteBuffer(outputBuffer || new Uint8Array(outputSize));
|
|
185
|
-
// TODO output.limit(outputSize)
|
|
186
|
-
if (output.length < outputSize) {
|
|
187
|
-
throw new errors_ts_1.CramMalformedError(`Output buffer too small to fit ${outputSize} bytes.`);
|
|
188
|
-
}
|
|
189
|
-
switch (order) {
|
|
190
|
-
case 0:
|
|
191
|
-
return uncompressOrder0Way4(input, output);
|
|
192
|
-
case 1:
|
|
193
|
-
return uncompressOrder1Way4(input, output);
|
|
194
|
-
default:
|
|
195
|
-
throw new errors_ts_1.CramMalformedError(`Invalid rANS order: ${order}`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
//# sourceMappingURL=index.js.map
|
package/dist/rans/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rans/index.ts"],"names":[],"mappings":";;;;;AAyMA,6BA2CC;AApPD,cAAc;AACd,4CAAiD;AACjD,sDAA0B;AAC1B,sDAA0B;AAC1B,gEAAoC;AACpC,qDAA2D;AAE3D,wCAAwC;AACxC,6CAA6C;AAC7C,MAAM,SAAS,CAAC,eAAe,GAAG,CAAC,CAAA;AACnC,uCAAuC;AACvC,iEAAiE;AAEjE,eAAe;AACf,iBAAiB;AAEjB,oDAAoD;AACpD,gBAAgB;AAChB,4CAA4C;AAC5C,6DAA6D;AAC7D,0EAA0E;AAC1E,YAAY;AACZ,QAAQ;AACR,IAAI;AAEJ,gGAAgG;AAChG,kCAAkC;AAClC,+BAA+B;AAE/B,iCAAiC;AACjC,iDAAiD;AAEjD,uBAAuB;AACvB,qBAAqB;AACrB,qDAAqD;AACrD,oBAAoB;AACpB,qDAAqD;AAErD,mBAAmB;AACnB,0EAA0E;AAC1E,QAAQ;AACR,IAAI;AAEJ,oEAAoE;AACpE,+EAA+E;AAC/E,yFAAyF;AACzF,2BAA2B;AAC3B,sDAAsD;AACtD,gDAAgD;AAChD,mEAAmE;AACnE,8CAA8C;AAC9C,sBAAsB;AACtB,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AAU,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAA;IAC/D,wCAAwC;IAExC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAA;IACzB,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,8BAAkB,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAA;IAC1C,IAAI,SAAS,KAAK,KAAK,CAAC,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;QACtD,MAAM,IAAI,8BAAkB,CAAC,yBAAyB,CAAC,CAAA;IACzD,CAAC;IAED,MAAM,SAAS,CAAC,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAA;IAC3C,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,YAAY,IAAI,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IACzE,gCAAgC;IAEhC,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;QAC/B,MAAM,IAAI,8BAAkB,CAC1B,kCAAkC,UAAU,SAAS,CACtD,CAAA;IACH,CAAC;IAED,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,CAAC;YACJ,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE5C,KAAK,CAAC;YACJ,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAE5C;YACE,MAAM,IAAI,8BAAkB,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAA;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
interface Stream {
|
|
2
|
-
readByte(): number;
|
|
3
|
-
seek(pos: number): void;
|
|
4
|
-
}
|
|
5
|
-
export default class BitReader {
|
|
6
|
-
private stream;
|
|
7
|
-
private bitOffset;
|
|
8
|
-
private curByte;
|
|
9
|
-
private hasByte;
|
|
10
|
-
constructor(stream: Stream);
|
|
11
|
-
private _ensureByte;
|
|
12
|
-
/**
|
|
13
|
-
* Reads bits from the buffer
|
|
14
|
-
* @param bits Number of bits to read
|
|
15
|
-
*/
|
|
16
|
-
read(bits: number): number;
|
|
17
|
-
/**
|
|
18
|
-
* Seek to an arbitrary point in the buffer (expressed in bits)
|
|
19
|
-
* @param pos Position in bits
|
|
20
|
-
*/
|
|
21
|
-
seek(pos: number): void;
|
|
22
|
-
/**
|
|
23
|
-
* Reads 6 bytes worth of data using the read method
|
|
24
|
-
*/
|
|
25
|
-
pi(): string;
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
node-bzip - a pure-javascript Node.JS module for decoding bzip2 data
|
|
4
|
-
|
|
5
|
-
Copyright (C) 2012 Eli Skeggs
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
-
a copy of this software and associated documentation files (the
|
|
9
|
-
"Software"), to deal in the Software without restriction, including
|
|
10
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
-
the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
-
|
|
26
|
-
Adapted from bzip2.js, copyright 2011 antimatter15 (antimatter15@gmail.com).
|
|
27
|
-
|
|
28
|
-
Based on micro-bunzip by Rob Landley (rob@landley.net).
|
|
29
|
-
|
|
30
|
-
Based on bzip2 decompression code by Julian R Seward (jseward@acm.org),
|
|
31
|
-
which also acknowledges contributions by Mike Burrows, David Wheeler,
|
|
32
|
-
Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
|
|
33
|
-
Robert Sedgewick, and Jon L. Bentley.
|
|
34
|
-
*/
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const toHex_ts_1 = require("./toHex.js");
|
|
37
|
-
const BITMASK = [0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff];
|
|
38
|
-
class BitReader {
|
|
39
|
-
constructor(stream) {
|
|
40
|
-
this.stream = stream;
|
|
41
|
-
this.bitOffset = 0;
|
|
42
|
-
this.curByte = 0;
|
|
43
|
-
this.hasByte = false;
|
|
44
|
-
}
|
|
45
|
-
_ensureByte() {
|
|
46
|
-
if (!this.hasByte) {
|
|
47
|
-
this.curByte = this.stream.readByte();
|
|
48
|
-
this.hasByte = true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Reads bits from the buffer
|
|
53
|
-
* @param bits Number of bits to read
|
|
54
|
-
*/
|
|
55
|
-
read(bits) {
|
|
56
|
-
let result = 0;
|
|
57
|
-
while (bits > 0) {
|
|
58
|
-
this._ensureByte();
|
|
59
|
-
const remaining = 8 - this.bitOffset;
|
|
60
|
-
// if we're in a byte
|
|
61
|
-
if (bits >= remaining) {
|
|
62
|
-
result <<= remaining;
|
|
63
|
-
result |= BITMASK[remaining] & this.curByte;
|
|
64
|
-
this.hasByte = false;
|
|
65
|
-
this.bitOffset = 0;
|
|
66
|
-
bits -= remaining;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
result <<= bits;
|
|
70
|
-
const shift = remaining - bits;
|
|
71
|
-
result |= (this.curByte & (BITMASK[bits] << shift)) >> shift;
|
|
72
|
-
this.bitOffset += bits;
|
|
73
|
-
bits = 0;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Seek to an arbitrary point in the buffer (expressed in bits)
|
|
80
|
-
* @param pos Position in bits
|
|
81
|
-
*/
|
|
82
|
-
seek(pos) {
|
|
83
|
-
const n_bit = pos % 8;
|
|
84
|
-
const n_byte = (pos - n_bit) / 8;
|
|
85
|
-
this.bitOffset = n_bit;
|
|
86
|
-
this.stream.seek(n_byte);
|
|
87
|
-
this.hasByte = false;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Reads 6 bytes worth of data using the read method
|
|
91
|
-
*/
|
|
92
|
-
pi() {
|
|
93
|
-
const buf = new Uint8Array(6);
|
|
94
|
-
for (let i = 0; i < buf.length; i++) {
|
|
95
|
-
buf[i] = this.read(8);
|
|
96
|
-
}
|
|
97
|
-
return (0, toHex_ts_1.toHex)(buf);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.default = BitReader;
|
|
101
|
-
//# sourceMappingURL=bitreader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bitreader.js","sourceRoot":"","sources":["../../src/seek-bzip/bitreader.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCE;;AAEF,yCAAkC;AAElC,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAA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AG,CAAC,CAAA;YACV,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,GAAW;QACd,MAAM,KAAK,GAAG,GAAG,GAAG,CAAC,CAAA;QACrB,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;QAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,EAAE;QACA,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,IAAA,gBAAK,EAAC,GAAG,CAAC,CAAA;IACnB,CAAC;CACF;AArED,4BAqEC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export default class CRC32 {
|
|
2
|
-
/**
|
|
3
|
-
* The current CRC
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
private crc;
|
|
7
|
-
/**
|
|
8
|
-
* Constructor initializes the CRC value
|
|
9
|
-
*/
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* @return The current CRC
|
|
13
|
-
*/
|
|
14
|
-
getCRC(): number;
|
|
15
|
-
/**
|
|
16
|
-
* Update the CRC with a single byte
|
|
17
|
-
* @param value The value to update the CRC with
|
|
18
|
-
*/
|
|
19
|
-
updateCRC(value: number): void;
|
|
20
|
-
/**
|
|
21
|
-
* Update the CRC with a sequence of identical bytes
|
|
22
|
-
* @param value The value to update the CRC with
|
|
23
|
-
* @param count The number of bytes
|
|
24
|
-
*/
|
|
25
|
-
updateCRCRun(value: number, count: number): void;
|
|
26
|
-
}
|
package/dist/seek-bzip/crc32.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* CRC32, used in Bzip2 implementation.
|
|
4
|
-
* This is a port of CRC32.java from the jbzip2 implementation at
|
|
5
|
-
* https://code.google.com/p/jbzip2
|
|
6
|
-
* which is:
|
|
7
|
-
* Copyright (c) 2011 Matthew Francis
|
|
8
|
-
*
|
|
9
|
-
* Permission is hereby granted, free of charge, to any person
|
|
10
|
-
* obtaining a copy of this software and associated documentation
|
|
11
|
-
* files (the "Software"), to deal in the Software without
|
|
12
|
-
* restriction, including without limitation the rights to use,
|
|
13
|
-
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
* copies of the Software, and to permit persons to whom the
|
|
15
|
-
* Software is furnished to do so, subject to the following
|
|
16
|
-
* conditions:
|
|
17
|
-
*
|
|
18
|
-
* The above copyright notice and this permission notice shall be
|
|
19
|
-
* included in all copies or substantial portions of the Software.
|
|
20
|
-
*
|
|
21
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
23
|
-
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
24
|
-
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
25
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
26
|
-
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
27
|
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
28
|
-
* OTHER DEALINGS IN THE SOFTWARE.
|
|
29
|
-
* This JavaScript implementation is:
|
|
30
|
-
* Copyright (c) 2013 C. Scott Ananian
|
|
31
|
-
* with the same licensing terms as Matthew Francis' original implementation.
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* A static CRC lookup table
|
|
35
|
-
*/
|
|
36
|
-
const crc32Lookup = new Uint32Array([
|
|
37
|
-
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
|
38
|
-
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
|
|
39
|
-
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
|
|
40
|
-
0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
|
|
41
|
-
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
|
|
42
|
-
0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
|
|
43
|
-
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
|
|
44
|
-
0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
|
|
45
|
-
0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
|
|
46
|
-
0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
|
|
47
|
-
0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
|
|
48
|
-
0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
|
|
49
|
-
0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
|
|
50
|
-
0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
|
|
51
|
-
0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
|
|
52
|
-
0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
|
|
53
|
-
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
|
|
54
|
-
0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
|
|
55
|
-
0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
|
|
56
|
-
0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
|
|
57
|
-
0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
|
|
58
|
-
0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
|
|
59
|
-
0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
|
|
60
|
-
0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
|
|
61
|
-
0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
|
|
62
|
-
0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
|
|
63
|
-
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
|
|
64
|
-
0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
|
|
65
|
-
0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
|
|
66
|
-
0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
|
|
67
|
-
0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
|
|
68
|
-
0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
|
|
69
|
-
0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
|
|
70
|
-
0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
|
|
71
|
-
0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
|
|
72
|
-
0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
|
|
73
|
-
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
|
|
74
|
-
0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
|
|
75
|
-
0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
|
|
76
|
-
0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
|
|
77
|
-
0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
|
|
78
|
-
0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
|
|
79
|
-
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4,
|
|
80
|
-
]);
|
|
81
|
-
class CRC32 {
|
|
82
|
-
/**
|
|
83
|
-
* Constructor initializes the CRC value
|
|
84
|
-
*/
|
|
85
|
-
constructor() {
|
|
86
|
-
this.crc = 0xffffffff;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @return The current CRC
|
|
90
|
-
*/
|
|
91
|
-
getCRC() {
|
|
92
|
-
return ~this.crc >>> 0; // return an unsigned value
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Update the CRC with a single byte
|
|
96
|
-
* @param value The value to update the CRC with
|
|
97
|
-
*/
|
|
98
|
-
updateCRC(value) {
|
|
99
|
-
this.crc =
|
|
100
|
-
(this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Update the CRC with a sequence of identical bytes
|
|
104
|
-
* @param value The value to update the CRC with
|
|
105
|
-
* @param count The number of bytes
|
|
106
|
-
*/
|
|
107
|
-
updateCRCRun(value, count) {
|
|
108
|
-
while (count-- > 0) {
|
|
109
|
-
this.crc =
|
|
110
|
-
(this.crc << 8) ^ crc32Lookup[((this.crc >>> 24) ^ value) & 0xff];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.default = CRC32;
|
|
115
|
-
//# sourceMappingURL=crc32.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crc32.js","sourceRoot":"","sources":["../../src/seek-bzip/crc32.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;IAClC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IACtE,UAAU,EAAE,UAAU,EAAE,UAAU,EA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|
-
declare class Bunzip {
|
|
2
|
-
constructor(inputStream: any, outputStream: any);
|
|
3
|
-
_init_block(): boolean;
|
|
4
|
-
_start_bunzip(inputStream: any, outputStream: any): void;
|
|
5
|
-
_get_next_block(): boolean;
|
|
6
|
-
_read_bunzip(outputBuffer: any, len: any): any;
|
|
7
|
-
}
|
|
8
|
-
export declare function decode(input: Uint8Array, output?: any, multistream?: any): any;
|
|
9
|
-
export default Bunzip;
|