node-pkware 5.7.0 → 5.9.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/README.md +68 -43
- package/dist/bin/explode.js +2 -2
- package/dist/bin/explode.js.map +1 -1
- package/dist/bin/implode.js +3 -3
- package/dist/bin/implode.js.map +1 -1
- package/dist/constants.d.ts +0 -22
- package/dist/constants.js +0 -24
- package/dist/constants.js.map +1 -1
- package/dist/functions.d.ts +7 -3
- package/dist/functions.js +26 -9
- package/dist/functions.js.map +1 -1
- package/dist/simple/Explode.d.ts +35 -12
- package/dist/simple/Explode.js +117 -95
- package/dist/simple/Explode.js.map +1 -1
- package/dist/simple/index.d.ts +3 -3
- package/dist/simple/index.js +3 -3
- package/dist/simple/index.js.map +1 -1
- package/dist/{ExpandingBuffer.js → stream/ExpandingBuffer.js} +1 -1
- package/dist/stream/ExpandingBuffer.js.map +1 -0
- package/dist/{Explode.d.ts → stream/Explode.d.ts} +4 -4
- package/dist/{Explode.js → stream/Explode.js} +8 -7
- package/dist/stream/Explode.js.map +1 -0
- package/dist/{Implode.d.ts → stream/Implode.d.ts} +3 -3
- package/dist/{Implode.js → stream/Implode.js} +5 -4
- package/dist/stream/Implode.js.map +1 -0
- package/dist/stream/constants.d.ts +22 -0
- package/dist/stream/constants.js +25 -0
- package/dist/stream/constants.js.map +1 -0
- package/dist/{index.d.ts → stream/index.d.ts} +7 -7
- package/dist/{index.js → stream/index.js} +5 -5
- package/dist/stream/index.js.map +1 -0
- package/dist/{stream.js → stream/stream.js} +2 -2
- package/dist/stream/stream.js.map +1 -0
- package/dist/stream/types.js.map +1 -0
- package/package.json +12 -8
- package/xo.config.ts +6 -1
- package/dist/ExpandingBuffer.js.map +0 -1
- package/dist/Explode.js.map +0 -1
- package/dist/Implode.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/stream.js.map +0 -1
- package/dist/types.js.map +0 -1
- /package/dist/{ExpandingBuffer.d.ts → stream/ExpandingBuffer.d.ts} +0 -0
- /package/dist/{stream.d.ts → stream/stream.d.ts} +0 -0
- /package/dist/{types.d.ts → stream/types.d.ts} +0 -0
- /package/dist/{types.js → stream/types.js} +0 -0
package/README.md
CHANGED
|
@@ -5,14 +5,14 @@ format that is commonly used today
|
|
|
5
5
|
|
|
6
6
|
It was the de-facto compression for games from around Y2K, like [Arx Fatalis](https://en.wikipedia.org/wiki/Arx_Fatalis)
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Installation / Updating existing version
|
|
9
9
|
|
|
10
10
|
`npm i -g node-pkware`
|
|
11
11
|
|
|
12
12
|
- minimum required node version: 18.0.0
|
|
13
13
|
- recommended node version (to be able to run the tests): 20.6.0
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Command Line Interface (CLI)
|
|
16
16
|
|
|
17
17
|
`explode [<filename>] [--offset=<offset>] [--drop-before-offset] [--output=<filename> [--verbose]]` - decompresses a file or a stream
|
|
18
18
|
|
|
@@ -33,7 +33,7 @@ For implode `<dictionary size>` can either be `--small`, `--medium` or `--large`
|
|
|
33
33
|
|
|
34
34
|
Calling either explode or implode with only the `-v` or `--version` flag will display the package's version
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Examples
|
|
37
37
|
|
|
38
38
|
`explode test/files/fast.fts --output=C:/fast.fts.decompressed --offset=1816`
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ Calling either explode or implode with only the `-v` or `--version` flag will di
|
|
|
41
41
|
|
|
42
42
|
`implode test/files/fast.fts.unpacked --output=C:/fast.fts --binary --large --offset=1816`
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Piping also works
|
|
45
45
|
|
|
46
46
|
`cat c:/arx/level8.llf | explode > c:/arx/level8.llf.unpacked`
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ Calling either explode or implode with only the `-v` or `--version` flag will di
|
|
|
55
55
|
|
|
56
56
|
`cat e:/piping/level8.llf.unpacked | implode --binary --large --output="e:/piping/level8.llf"`
|
|
57
57
|
|
|
58
|
-
##
|
|
58
|
+
## Using as a library
|
|
59
59
|
|
|
60
60
|
### API (named imports of node-pkware)
|
|
61
61
|
|
|
@@ -121,13 +121,46 @@ The returned function has the `(chunk: Buffer, encoding: string, callback: funct
|
|
|
121
121
|
|
|
122
122
|
`errors.AbortedError` - thrown by explode when compressed data ends without reaching the end literal or in mid decompression
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### Examples
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
There are 2 APIs: "node-pkware/simple" and "node-pkware/stream".
|
|
127
|
+
The "simple" api is recommended as it is much more performant compared to the "stream" api.
|
|
128
|
+
|
|
129
|
+
#### Compressing ArrayBuffer with the "simple" API (works in browser too)
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
import { implode } from 'node-pkware/simple'
|
|
133
|
+
|
|
134
|
+
const inputString = 'hello pkware!'
|
|
135
|
+
|
|
136
|
+
// create an ArrayBuffer from inputString
|
|
137
|
+
const encoder = new TextEncoder()
|
|
138
|
+
const input = encoder.encode(inputString).buffer
|
|
139
|
+
|
|
140
|
+
// compress it and get the result in an ArrayBuffer - all done synchronously
|
|
141
|
+
const output = implode(input, 'ascii', 'large')
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Decompressing ArrayBuffer with the "simple" API (works in browser too)
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
import { explode } from 'node-pkware/simple'
|
|
148
|
+
|
|
149
|
+
// get input as ArrayBuffer from a fetch response
|
|
150
|
+
const response = await fetch(
|
|
151
|
+
'https://raw.githubusercontent.com/arx-tools/pkware-test-files/refs/heads/main/arx-fatalis/level8/level8.dlf',
|
|
152
|
+
)
|
|
153
|
+
const compressedInput = await response.arrayBuffer()
|
|
154
|
+
|
|
155
|
+
// decompress it and get the result in an ArrayBuffer - all done synchronously
|
|
156
|
+
const output = explode(compressedInput)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Decompressing file with no offset into a file (node.js only)
|
|
127
160
|
|
|
128
161
|
```js
|
|
129
|
-
|
|
130
|
-
|
|
162
|
+
import fs from 'node:fs'
|
|
163
|
+
import { explode, stream } from 'node-pkware/stream'
|
|
131
164
|
const { through } = stream
|
|
132
165
|
|
|
133
166
|
fs.createReadStream(`path-to-compressed-file`)
|
|
@@ -135,11 +168,11 @@ fs.createReadStream(`path-to-compressed-file`)
|
|
|
135
168
|
.pipe(fs.createWriteStream(`path-to-write-decompressed-data`))
|
|
136
169
|
```
|
|
137
170
|
|
|
138
|
-
####
|
|
171
|
+
#### Decompressing buffer with no offset into a buffer (node.js only)
|
|
139
172
|
|
|
140
173
|
```js
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
import { Readable } from 'node:stream'
|
|
175
|
+
import { explode, stream } from 'node-pkware/stream'
|
|
143
176
|
const { through, toBuffer } = stream
|
|
144
177
|
|
|
145
178
|
Readable.from(buffer) // buffer is of type Buffer with compressed data
|
|
@@ -151,11 +184,11 @@ Readable.from(buffer) // buffer is of type Buffer with compressed data
|
|
|
151
184
|
)
|
|
152
185
|
```
|
|
153
186
|
|
|
154
|
-
####
|
|
187
|
+
#### Decompressing file with offset into a file, keeping initial part intact (node.js only)
|
|
155
188
|
|
|
156
189
|
```js
|
|
157
|
-
|
|
158
|
-
|
|
190
|
+
import fs from 'node:fs'
|
|
191
|
+
import { explode, stream } from 'node-pkware/stream'
|
|
159
192
|
const { through, transformSplitBy, splitAt, transformIdentity } = stream
|
|
160
193
|
|
|
161
194
|
const offset = 150 // 150 bytes of data will be skipped and explode will decompress the data that comes afterwards
|
|
@@ -165,11 +198,11 @@ fs.createReadStream(`path-to-compressed-file`)
|
|
|
165
198
|
.pipe(fs.createWriteStream(`path-to-write-decompressed-data`))
|
|
166
199
|
```
|
|
167
200
|
|
|
168
|
-
####
|
|
201
|
+
#### Decompressing file with offset into a file, discarding initial part (node.js only)
|
|
169
202
|
|
|
170
203
|
```js
|
|
171
|
-
|
|
172
|
-
|
|
204
|
+
import fs from 'node:fs'
|
|
205
|
+
import { explode, stream } from 'node-pkware/stream'
|
|
173
206
|
const { through, transformSplitBy, splitAt, transformEmpty } = stream
|
|
174
207
|
|
|
175
208
|
const offset = 150 // 150 bytes of data will be skipped and explode will decompress the data that comes afterwards
|
|
@@ -179,30 +212,11 @@ fs.createReadStream(`path-to-compressed-file`)
|
|
|
179
212
|
.pipe(fs.createWriteStream(`path-to-write-decompressed-data`))
|
|
180
213
|
```
|
|
181
214
|
|
|
182
|
-
####
|
|
215
|
+
#### Catching errors (node.js only)
|
|
183
216
|
|
|
184
217
|
```js
|
|
185
|
-
import
|
|
186
|
-
import {
|
|
187
|
-
|
|
188
|
-
const inputString = 'hello pkware!'
|
|
189
|
-
|
|
190
|
-
// create an ArrayBuffer from inputString
|
|
191
|
-
const encoder = new TextEncoder()
|
|
192
|
-
const input = encoder.encode(inputString).buffer
|
|
193
|
-
|
|
194
|
-
// compress it and get the result in another ArrayBuffer
|
|
195
|
-
const output = implode(input, 'ascii', 'large')
|
|
196
|
-
|
|
197
|
-
// write the output to a file
|
|
198
|
-
await fs.writeFile('/tmp/compressedHello', new Uint8Array(output))
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Catching errors
|
|
202
|
-
|
|
203
|
-
```js
|
|
204
|
-
const fs = require('node:fs')
|
|
205
|
-
const { explode, stream } = require('node-pkware')
|
|
218
|
+
import fs from 'node:fs'
|
|
219
|
+
import { explode, stream } from 'node-pkware/stream'
|
|
206
220
|
const { through } = stream
|
|
207
221
|
|
|
208
222
|
fs.createReadStream(`path-to-compressed-file`)
|
|
@@ -221,13 +235,24 @@ fs.createReadStream(`path-to-compressed-file`)
|
|
|
221
235
|
)
|
|
222
236
|
```
|
|
223
237
|
|
|
238
|
+
## Other infos
|
|
239
|
+
|
|
240
|
+
`TypedArray.byteLength` is much slower compared to caching the length of the TypedArray yourself, even though the
|
|
241
|
+
[documentation on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer#instance_properties)
|
|
242
|
+
says that:
|
|
243
|
+
|
|
244
|
+
> The size, in bytes, of the ArrayBuffer. This is established when the array is constructed and can only be
|
|
245
|
+
> changed using the ArrayBuffer.prototype.resize() method if the ArrayBuffer is resizable.
|
|
246
|
+
|
|
247
|
+
_(tested in node v20.19.2)_
|
|
248
|
+
|
|
224
249
|
## Useful links
|
|
225
250
|
|
|
226
|
-
###
|
|
251
|
+
### Test files
|
|
227
252
|
|
|
228
253
|
https://github.com/arx-tools/pkware-test-files
|
|
229
254
|
|
|
230
|
-
###
|
|
255
|
+
### Sources
|
|
231
256
|
|
|
232
257
|
- https://github.com/ladislav-zezula/StormLib/tree/master/src/pklib
|
|
233
258
|
- https://github.com/ShieldBattery/implode-decoder
|
|
@@ -237,7 +262,7 @@ https://github.com/arx-tools/pkware-test-files
|
|
|
237
262
|
|
|
238
263
|
Implode was removed from Arx Libertatis at this commit: https://github.com/arx/ArxLibertatis/commit/2db9f0dd023fdd5d4da6f06c08a92d932e218187
|
|
239
264
|
|
|
240
|
-
###
|
|
265
|
+
### Miscellaneous
|
|
241
266
|
|
|
242
267
|
- https://stackoverflow.com/questions/2094666/pointers-in-c-when-to-use-the-ampersand-and-the-asterisk
|
|
243
268
|
- https://stackoverflow.com/a/49394095/1806628
|
package/dist/bin/explode.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import * as process from 'node:process';
|
|
3
3
|
import minimist from 'minimist-lite';
|
|
4
4
|
import { getPackageVersion, parseNumberString, getInputStream, getOutputStream } from './helpers.js';
|
|
5
|
-
import { transformEmpty, transformIdentity, transformSplitBy, splitAt, through, } from '../stream.js';
|
|
6
|
-
import { explode } from '../index.js';
|
|
5
|
+
import { transformEmpty, transformIdentity, transformSplitBy, splitAt, through, } from '../stream/stream.js';
|
|
6
|
+
import { explode } from '../stream/index.js';
|
|
7
7
|
const args = minimist(process.argv.slice(2), {
|
|
8
8
|
string: ['output', 'offset'],
|
|
9
9
|
boolean: ['version', 'drop-before-offset', 'verbose'],
|
package/dist/bin/explode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explode.js","sourceRoot":"","sources":["../../src/bin/explode.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,OAAO,GAER,MAAM,
|
|
1
|
+
{"version":3,"file":"explode.js","sourceRoot":"","sources":["../../src/bin/explode.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,OAAO,GAER,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAY9C,MAAM,IAAI,GAAY,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACpD,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,OAAO,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,SAAS,CAAC;IACrD,KAAK,EAAE;QACL,CAAC,EAAE,SAAS;KACb;CACF,CAAC,CAAA;AAEF,8GAA8G;AAC9G,KAAK,UAAU,UAAU,CACvB,KAA4B,EAC5B,MAA6B,EAC7B,MAAc,EACd,UAAmB,EACnB,MAAc;IAEd,IAAI,WAA0B,CAAA;IAC9B,IAAI,UAAU,EA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,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAChD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;AAC9C,MAAM,MAAM,GAAW;IACrB,OAAO,EAAE,IAAI,CAAC,OAAO;CACtB,CAAA;AAED,IAAI,CAAC;IACH,MAAM,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAA;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAAC,OAAO,KAAc,EAAE,CAAC;IACxB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAG,KAAe,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
package/dist/bin/implode.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --enable-source-maps
|
|
2
2
|
import * as process from 'node:process';
|
|
3
3
|
import minimist from 'minimist-lite';
|
|
4
|
-
import { Compression, DictionarySize } from '../constants.js';
|
|
4
|
+
import { Compression, DictionarySize } from '../stream/constants.js';
|
|
5
5
|
import { getPackageVersion, parseNumberString, getInputStream, getOutputStream } from './helpers.js';
|
|
6
|
-
import { transformEmpty, transformIdentity, transformSplitBy, splitAt, through, } from '../stream.js';
|
|
7
|
-
import { implode } from '../index.js';
|
|
6
|
+
import { transformEmpty, transformIdentity, transformSplitBy, splitAt, through, } from '../stream/stream.js';
|
|
7
|
+
import { implode } from '../stream/index.js';
|
|
8
8
|
const args = minimist(process.argv.slice(2), {
|
|
9
9
|
string: ['output', 'offset'],
|
|
10
10
|
boolean: ['version', 'ascii', 'binary', 'small', 'medium', 'large', 'drop-before-offset', 'verbose'],
|
package/dist/bin/implode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implode.js","sourceRoot":"","sources":["../../src/bin/implode.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"implode.js","sourceRoot":"","sources":["../../src/bin/implode.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,OAAO,GAER,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAsB9C,MAAM,IAAI,GAAY,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACpD,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,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,EAAE,OAAO;KACX;CACF,CAAC,CAAA;AAEF,8HAA8H;AAC9H,KAAK,UAAU,QAAQ,CACrB,KAA4B,EAC5B,MAA6B,EAC7B,MAAc,EACd,UAAmB,EACnB,eAA4B,EAC5B,cAA8B,EAC9B,MAAc;IAEd,IAAI,WAA0B,CAAA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AAI,CAAC,MAAM,EAAE,CAAC;IACvB,cAAc,GAAG,cAAc,CAAC,MAAM,CAAA;AACxC,CAAC;KAAM,CAAC;IACN,cAAc,GAAG,cAAc,CAAC,KAAK,CAAA;AACvC,CAAC;AAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAChD,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAA;AAC9C,MAAM,MAAM,GAAW;IACrB,OAAO,EAAE,IAAI,CAAC,OAAO;CACtB,CAAA;AAED,IAAI,CAAC;IACH,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC,CAAA;IAC1F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC;AAAC,OAAO,KAAc,EAAE,CAAC;IACxB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAG,KAAe,CAAC,OAAO,CAAC,CAAA;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compression types for implode
|
|
3
|
-
*/
|
|
4
|
-
export declare enum Compression {
|
|
5
|
-
Unknown = -1,
|
|
6
|
-
Binary = 0,
|
|
7
|
-
Ascii = 1
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Dictionary sizes for implode, determines how well the file get compressed.
|
|
11
|
-
*
|
|
12
|
-
* Small dictionary size means less memory to lookback in data for repetitions,
|
|
13
|
-
* 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
|
|
15
|
-
* compression, thus generating smaller, more compressed files.
|
|
16
|
-
*/
|
|
17
|
-
export declare enum DictionarySize {
|
|
18
|
-
Unknown = -1,
|
|
19
|
-
Small = 4,
|
|
20
|
-
Medium = 5,
|
|
21
|
-
Large = 6
|
|
22
|
-
}
|
|
23
1
|
export declare const LONGEST_ALLOWED_REPETITION = 516;
|
|
24
2
|
export declare const LITERAL_END_STREAM = 773;
|
|
25
3
|
export declare const DistCode: number[];
|
package/dist/constants.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compression types for implode
|
|
3
|
-
*/
|
|
4
|
-
export var Compression;
|
|
5
|
-
(function (Compression) {
|
|
6
|
-
Compression[Compression["Unknown"] = -1] = "Unknown";
|
|
7
|
-
Compression[Compression["Binary"] = 0] = "Binary";
|
|
8
|
-
Compression[Compression["Ascii"] = 1] = "Ascii";
|
|
9
|
-
})(Compression || (Compression = {}));
|
|
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,
|
|
14
|
-
* meaning it will be less effective, the file stays larger, less compressed.
|
|
15
|
-
* On the other hand, large compression allows more lookback allowing more effective
|
|
16
|
-
* compression, thus generating smaller, more compressed files.
|
|
17
|
-
*/
|
|
18
|
-
export var DictionarySize;
|
|
19
|
-
(function (DictionarySize) {
|
|
20
|
-
DictionarySize[DictionarySize["Unknown"] = -1] = "Unknown";
|
|
21
|
-
DictionarySize[DictionarySize["Small"] = 4] = "Small";
|
|
22
|
-
DictionarySize[DictionarySize["Medium"] = 5] = "Medium";
|
|
23
|
-
DictionarySize[DictionarySize["Large"] = 6] = "Large";
|
|
24
|
-
})(DictionarySize || (DictionarySize = {}));
|
|
25
1
|
export const LONGEST_ALLOWED_REPETITION = 0x2_04;
|
|
26
2
|
export const LITERAL_END_STREAM = 0x3_05;
|
|
27
3
|
// prettier-ignore
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA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OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;IACtE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;CACvE,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAA"}
|
package/dist/functions.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ export declare function repeat<T>(value: T, repetitions: number): T[];
|
|
|
20
20
|
/**
|
|
21
21
|
* Makes sure `n` is between `min` and `max`:
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
23
|
* @example
|
|
25
24
|
* ```js
|
|
26
25
|
* clamp(8, 3, 7) === 7
|
|
@@ -106,7 +105,7 @@ export declare function toHex(num: number, digits?: number, withoutPrefix?: bool
|
|
|
106
105
|
* mergeSparseArrays(a, b) // -> [1, undefined, 2, 13, 3]
|
|
107
106
|
* ```
|
|
108
107
|
*/
|
|
109
|
-
export declare function mergeSparseArrays<T>(a: T[], b: T[]):
|
|
108
|
+
export declare function mergeSparseArrays<T>(a: T[], b: T[]): Array<T | undefined>;
|
|
110
109
|
/**
|
|
111
110
|
* Builds a list from a seed value. Accepts an iterator function, which returns
|
|
112
111
|
* either false to stop iteration or an array of length 2 containing the value
|
|
@@ -141,6 +140,11 @@ export declare function unfold<T, TResult>(fn: (seed: T) => [result: TResult, ne
|
|
|
141
140
|
export declare function quotientAndRemainder(dividend: number, divisor: number): [quotient: number, remainder: number];
|
|
142
141
|
/**
|
|
143
142
|
* @see https://stackoverflow.com/a/49129872/1806628
|
|
143
|
+
*
|
|
144
144
|
*/
|
|
145
|
-
export declare function
|
|
145
|
+
export declare function concatArrayBuffersAndLengthedDatas(buffers: Array<ArrayBufferLike | {
|
|
146
|
+
data: number[];
|
|
147
|
+
byteLength: number;
|
|
148
|
+
}>, totalLength?: number): ArrayBuffer;
|
|
146
149
|
export declare function sliceArrayBufferAt(buffer: ArrayBufferLike, at: number): [ArrayBuffer, ArrayBuffer];
|
|
150
|
+
export declare function uint8ArrayToArray(view: Uint8Array, from: number, length: number): number[];
|
package/dist/functions.js
CHANGED
|
@@ -26,7 +26,6 @@ export function repeat(value, repetitions) {
|
|
|
26
26
|
/**
|
|
27
27
|
* Makes sure `n` is between `min` and `max`:
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
29
|
* @example
|
|
31
30
|
* ```js
|
|
32
31
|
* clamp(8, 3, 7) === 7
|
|
@@ -51,7 +50,7 @@ export function clamp(n, min, max) {
|
|
|
51
50
|
/**
|
|
52
51
|
* @see https://github.com/ramda/ramda/blob/master/source/internal/_isFunction.js
|
|
53
52
|
*/
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- I'm perfectly happy with only
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- I'm perfectly happy with only knowing whether the input a function or not, nothing more is needed to be done by this function
|
|
55
54
|
export function isFunction(x) {
|
|
56
55
|
return Object.prototype.toString.call(x) === '[object Function]';
|
|
57
56
|
}
|
|
@@ -196,22 +195,33 @@ export function unfold(fn, seed) {
|
|
|
196
195
|
export function quotientAndRemainder(dividend, divisor) {
|
|
197
196
|
return [Math.floor(dividend / divisor), dividend % divisor];
|
|
198
197
|
}
|
|
198
|
+
function isArrayBufferLike(buffer) {
|
|
199
|
+
return buffer instanceof ArrayBuffer || buffer instanceof SharedArrayBuffer;
|
|
200
|
+
}
|
|
199
201
|
/**
|
|
200
202
|
* @see https://stackoverflow.com/a/49129872/1806628
|
|
203
|
+
*
|
|
201
204
|
*/
|
|
202
|
-
export function
|
|
203
|
-
if (buffers.length === 1) {
|
|
205
|
+
export function concatArrayBuffersAndLengthedDatas(buffers, totalLength) {
|
|
206
|
+
if (buffers.length === 1 && 'byteLength' in buffers[0]) {
|
|
204
207
|
return buffers[0];
|
|
205
208
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
if (totalLength === undefined) {
|
|
210
|
+
totalLength = 0;
|
|
211
|
+
for (const buffer of buffers) {
|
|
212
|
+
totalLength = totalLength + buffer.byteLength;
|
|
213
|
+
}
|
|
209
214
|
}
|
|
210
215
|
const combinedBuffer = new Uint8Array(totalLength);
|
|
211
216
|
let offset = 0;
|
|
212
217
|
for (const buffer of buffers) {
|
|
213
|
-
|
|
214
|
-
|
|
218
|
+
if (isArrayBufferLike(buffer)) {
|
|
219
|
+
const view = new Uint8Array(buffer);
|
|
220
|
+
combinedBuffer.set(view, offset);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
combinedBuffer.set(buffer.data, offset);
|
|
224
|
+
}
|
|
215
225
|
offset = offset + buffer.byteLength;
|
|
216
226
|
}
|
|
217
227
|
return combinedBuffer.buffer;
|
|
@@ -222,4 +232,11 @@ export function sliceArrayBufferAt(buffer, at) {
|
|
|
222
232
|
const right = view.slice(at).buffer;
|
|
223
233
|
return [left, right];
|
|
224
234
|
}
|
|
235
|
+
export function uint8ArrayToArray(view, from, length) {
|
|
236
|
+
const arr = [];
|
|
237
|
+
for (let i = 0; i < length; i++) {
|
|
238
|
+
arr.push(view[from + i]);
|
|
239
|
+
}
|
|
240
|
+
return arr;
|
|
241
|
+
}
|
|
225
242
|
//# sourceMappingURL=functions.js.map
|
package/dist/functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM,CAAI,KAAQ,EAAE,WAAmB;IACrD,MAAM,MAAM,GAAQ,EAAE,CAAA;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM,CAAI,KAAQ,EAAE,WAAmB;IACrD,MAAM,MAAM,GAAQ,EAAE,CAAA;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,CAAS,EAAE,GAAW,EAAE,GAAW;IACvD,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACZ,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACZ,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,OAAO,CAAC,CAAA;AACV,CAAC;AAED;;GAEG;AACH,uMAAuM;AACvM,MAAM,UAAU,UAAU,CAAC,CAAM;IAC/B,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,mBAAmB,CAAA;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,U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AExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAA;IAC1B,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/simple/Explode.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
export declare class Explode {
|
|
2
|
+
private readonly inputBuffer;
|
|
3
|
+
/**
|
|
4
|
+
* Used for accessing the data within inputBuffer
|
|
5
|
+
*/
|
|
6
|
+
private readonly inputBufferView;
|
|
7
|
+
/**
|
|
8
|
+
* Used for caching inputBuffer.byteLength as that getter is doing some uncached computation to measure the length of
|
|
9
|
+
* inputBuffer
|
|
10
|
+
*/
|
|
11
|
+
private readonly inputBufferSize;
|
|
12
|
+
/**
|
|
13
|
+
* The explode algorithm works by trimming off the beginning of inputBuffer byte by byte. Instead of actually
|
|
14
|
+
* adjusting the inputBuffer every time a byte is handled we store the beginning of the unhandled section and use it
|
|
15
|
+
* when indexing data that is being read.
|
|
16
|
+
*/
|
|
17
|
+
private inputBufferStartIndex;
|
|
18
|
+
private outputBuffer;
|
|
19
|
+
private outputBufferView;
|
|
20
|
+
private outputBufferSize;
|
|
2
21
|
private needMoreInput;
|
|
3
22
|
private extraBits;
|
|
4
23
|
private bitBuffer;
|
|
5
24
|
private readonly lengthCodes;
|
|
6
25
|
private readonly distPosCodes;
|
|
7
|
-
private inputBuffer;
|
|
8
|
-
private inputBufferStartIndex;
|
|
9
|
-
private outputBuffer;
|
|
10
26
|
private compressionType;
|
|
11
27
|
private dictionarySize;
|
|
12
28
|
private dictionarySizeMask;
|
|
@@ -27,26 +43,33 @@ export declare class Explode {
|
|
|
27
43
|
* the naming comes from stormlib, the 2EB4 refers to the table's position in memory
|
|
28
44
|
*/
|
|
29
45
|
private asciiTable2EB4;
|
|
30
|
-
constructor();
|
|
46
|
+
constructor(input: ArrayBufferLike);
|
|
31
47
|
/**
|
|
32
|
-
* @throws
|
|
33
|
-
* @throws
|
|
34
|
-
* @throws
|
|
48
|
+
* @throws `InvalidCompressionTypeError`
|
|
49
|
+
* @throws `InvalidDictionarySizeError`
|
|
50
|
+
* @throws `AbortedError`
|
|
35
51
|
*/
|
|
36
|
-
|
|
52
|
+
getResult(): ArrayBuffer;
|
|
37
53
|
private generateAsciiTables;
|
|
38
54
|
/**
|
|
39
|
-
* @throws
|
|
55
|
+
* @throws `AbortedError` when there isn't enough data to be wasted
|
|
40
56
|
*/
|
|
41
57
|
private wasteBits;
|
|
42
58
|
/**
|
|
43
|
-
* @throws
|
|
59
|
+
* @throws `AbortedError`
|
|
44
60
|
*/
|
|
45
61
|
private decodeNextLiteral;
|
|
46
62
|
/**
|
|
47
|
-
* @throws
|
|
63
|
+
* @throws `AbortedError`
|
|
48
64
|
*/
|
|
49
65
|
private decodeDistance;
|
|
50
|
-
private
|
|
66
|
+
private processInput;
|
|
51
67
|
private parseInitialData;
|
|
68
|
+
/**
|
|
69
|
+
* This function assumes there are at least 2 bytes of data in the buffer
|
|
70
|
+
*
|
|
71
|
+
* @throws `InvalidCompressionTypeError`
|
|
72
|
+
* @throws `InvalidDictionarySizeError`
|
|
73
|
+
*/
|
|
74
|
+
private readHeader;
|
|
52
75
|
}
|