compress-utils 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +131 -82
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/algorithms/brotli/brotli.wasm +0 -0
  4. package/dist/algorithms/brotli/compress/brotli.wasm +0 -0
  5. package/dist/algorithms/brotli/compress/index.d.ts +2 -2
  6. package/dist/algorithms/brotli/compress/index.d.ts.map +1 -1
  7. package/dist/algorithms/brotli/decompress/brotli.wasm +0 -0
  8. package/dist/algorithms/brotli/decompress/index.d.ts +3 -3
  9. package/dist/algorithms/brotli/decompress/index.d.ts.map +1 -1
  10. package/dist/algorithms/brotli/index.d.ts +4 -4
  11. package/dist/algorithms/brotli/index.d.ts.map +1 -1
  12. package/dist/algorithms/bz2/bz2.wasm +0 -0
  13. package/dist/algorithms/bz2/compress/bz2.wasm +0 -0
  14. package/dist/algorithms/bz2/compress/index.d.ts +2 -2
  15. package/dist/algorithms/bz2/compress/index.d.ts.map +1 -1
  16. package/dist/algorithms/bz2/decompress/bz2.wasm +0 -0
  17. package/dist/algorithms/bz2/decompress/index.d.ts +3 -3
  18. package/dist/algorithms/bz2/decompress/index.d.ts.map +1 -1
  19. package/dist/algorithms/bz2/index.d.ts +4 -4
  20. package/dist/algorithms/bz2/index.d.ts.map +1 -1
  21. package/dist/algorithms/deflate/compress/index.d.ts +2 -2
  22. package/dist/algorithms/deflate/compress/index.d.ts.map +1 -1
  23. package/dist/algorithms/deflate/decompress/index.d.ts +3 -3
  24. package/dist/algorithms/deflate/decompress/index.d.ts.map +1 -1
  25. package/dist/algorithms/deflate/index.d.ts +4 -4
  26. package/dist/algorithms/deflate/index.d.ts.map +1 -1
  27. package/dist/algorithms/gzip/compress/gzip.wasm +0 -0
  28. package/dist/algorithms/gzip/compress/index.d.ts +2 -2
  29. package/dist/algorithms/gzip/compress/index.d.ts.map +1 -1
  30. package/dist/algorithms/gzip/decompress/gzip.wasm +0 -0
  31. package/dist/algorithms/gzip/decompress/index.d.ts +3 -3
  32. package/dist/algorithms/gzip/decompress/index.d.ts.map +1 -1
  33. package/dist/algorithms/gzip/gzip.wasm +0 -0
  34. package/dist/algorithms/gzip/index.d.ts +4 -4
  35. package/dist/algorithms/gzip/index.d.ts.map +1 -1
  36. package/dist/algorithms/lz4/compress/index.d.ts +2 -2
  37. package/dist/algorithms/lz4/compress/index.d.ts.map +1 -1
  38. package/dist/algorithms/lz4/compress/lz4.wasm +0 -0
  39. package/dist/algorithms/lz4/decompress/index.d.ts +3 -3
  40. package/dist/algorithms/lz4/decompress/index.d.ts.map +1 -1
  41. package/dist/algorithms/lz4/decompress/lz4.wasm +0 -0
  42. package/dist/algorithms/lz4/index.d.ts +4 -4
  43. package/dist/algorithms/lz4/index.d.ts.map +1 -1
  44. package/dist/algorithms/lz4/lz4.wasm +0 -0
  45. package/dist/algorithms/lz4_raw/decompress/index.d.ts +12 -2
  46. package/dist/algorithms/lz4_raw/decompress/index.d.ts.map +1 -1
  47. package/dist/algorithms/lz4_raw/decompress/index.js +10 -1
  48. package/dist/algorithms/lz4_raw/decompress/index.js.map +1 -1
  49. package/dist/algorithms/lz4_raw/index.d.ts +12 -2
  50. package/dist/algorithms/lz4_raw/index.d.ts.map +1 -1
  51. package/dist/algorithms/lz4_raw/index.js +10 -1
  52. package/dist/algorithms/lz4_raw/index.js.map +1 -1
  53. package/dist/algorithms/lzo/decompress/index.d.ts +14 -7
  54. package/dist/algorithms/lzo/decompress/index.d.ts.map +1 -1
  55. package/dist/algorithms/lzo/decompress/index.js +13 -4
  56. package/dist/algorithms/lzo/decompress/index.js.map +1 -1
  57. package/dist/algorithms/lzo/decompress/lzo.wasm +0 -0
  58. package/dist/algorithms/snappy/compress/index.d.ts +2 -2
  59. package/dist/algorithms/snappy/compress/index.d.ts.map +1 -1
  60. package/dist/algorithms/snappy/compress/snappy.wasm +0 -0
  61. package/dist/algorithms/snappy/decompress/index.d.ts +3 -3
  62. package/dist/algorithms/snappy/decompress/index.d.ts.map +1 -1
  63. package/dist/algorithms/snappy/decompress/snappy.wasm +0 -0
  64. package/dist/algorithms/snappy/index.d.ts +4 -4
  65. package/dist/algorithms/snappy/index.d.ts.map +1 -1
  66. package/dist/algorithms/snappy/snappy.wasm +0 -0
  67. package/dist/algorithms/xz/compress/index.d.ts +2 -2
  68. package/dist/algorithms/xz/compress/index.d.ts.map +1 -1
  69. package/dist/algorithms/xz/compress/xz.wasm +0 -0
  70. package/dist/algorithms/xz/decompress/index.d.ts +3 -3
  71. package/dist/algorithms/xz/decompress/index.d.ts.map +1 -1
  72. package/dist/algorithms/xz/decompress/xz.wasm +0 -0
  73. package/dist/algorithms/xz/index.d.ts +4 -4
  74. package/dist/algorithms/xz/index.d.ts.map +1 -1
  75. package/dist/algorithms/xz/xz.wasm +0 -0
  76. package/dist/algorithms/zlib/compress/index.d.ts +2 -2
  77. package/dist/algorithms/zlib/compress/index.d.ts.map +1 -1
  78. package/dist/algorithms/zlib/compress/zlib.wasm +0 -0
  79. package/dist/algorithms/zlib/decompress/index.d.ts +3 -3
  80. package/dist/algorithms/zlib/decompress/index.d.ts.map +1 -1
  81. package/dist/algorithms/zlib/decompress/zlib.wasm +0 -0
  82. package/dist/algorithms/zlib/index.d.ts +4 -4
  83. package/dist/algorithms/zlib/index.d.ts.map +1 -1
  84. package/dist/algorithms/zlib/zlib.wasm +0 -0
  85. package/dist/algorithms/zstd/compress/index.d.ts +2 -2
  86. package/dist/algorithms/zstd/compress/index.d.ts.map +1 -1
  87. package/dist/algorithms/zstd/compress/zstd.wasm +0 -0
  88. package/dist/algorithms/zstd/decompress/index.d.ts +3 -3
  89. package/dist/algorithms/zstd/decompress/index.d.ts.map +1 -1
  90. package/dist/algorithms/zstd/decompress/zstd.wasm +0 -0
  91. package/dist/algorithms/zstd/index.d.ts +4 -4
  92. package/dist/algorithms/zstd/index.d.ts.map +1 -1
  93. package/dist/algorithms/zstd/zstd.wasm +0 -0
  94. package/dist/core/capacity.d.ts +1 -1
  95. package/dist/core/capacity.d.ts.map +1 -1
  96. package/dist/core/capacity.js +5 -6
  97. package/dist/core/capacity.js.map +1 -1
  98. package/dist/core/dispatch.d.ts +49 -10
  99. package/dist/core/dispatch.d.ts.map +1 -1
  100. package/dist/core/dispatch.js +85 -11
  101. package/dist/core/dispatch.js.map +1 -1
  102. package/dist/core/loader.d.ts +4 -0
  103. package/dist/core/loader.d.ts.map +1 -1
  104. package/dist/core/loader.js.map +1 -1
  105. package/dist/core/types.d.ts +22 -0
  106. package/dist/core/types.d.ts.map +1 -1
  107. package/package.json +2 -1
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/compress-utils.svg)](https://www.npmjs.com/package/compress-utils)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/compress-utils.svg)](https://www.npmjs.com/package/compress-utils)
5
- [![types: built-in](https://img.shields.io/badge/types-built--in-blue.svg)](https://www.npmjs.com/package/compress-utils)
5
+ [![WASM build](https://img.shields.io/github/actions/workflow/status/dupontcyborg/compress-utils/build_and_test_wasm.yml?label=wasm)](https://github.com/dupontcyborg/compress-utils/actions/workflows/build_and_test_wasm.yml)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- Unified WebAssembly bindings for eight compression algorithms: Brotli, bzip2, LZ4, XZ/LZMA, zlib, Zstandard, Snappy, and gzip. Same API for every algorithm, in every JavaScript runtime, with tree-shakeable imports so bundlers ship only what you use.
8
+ Unified WebAssembly bindings for eight compression algorithms — Zstandard, Brotli, zlib, gzip, bzip2, LZ4, XZ/LZMA, and Snappy — over a single high-performance C core. Same API for every algorithm, in every JavaScript runtime, with tree-shakeable imports so bundlers ship only what you use.
9
9
 
10
10
  ## Installation
11
11
 
@@ -16,39 +16,72 @@ npm install compress-utils
16
16
 
17
17
  ### CDN (no bundler)
18
18
 
19
- The package is published as ESM. You can pull it straight from a CDN — no install step, no build step.
19
+ The package is published as ESM. You can pull it straight from a CDN, with no install step and no build step.
20
20
 
21
21
  ```html
22
22
  <script type="module">
23
- import { compress, decompress } from
24
- "https://esm.sh/compress-utils/zstd";
23
+ import { compress, decompress } from "https://esm.sh/compress-utils/zstd";
25
24
 
26
- const out = await compress(
27
- new TextEncoder().encode("hello")
28
- );
25
+ const out = await compress(new TextEncoder().encode("hello"));
29
26
  </script>
30
27
  ```
31
28
 
32
- | CDN | Per-algo URL |
33
- |------------|-----------------------------------------------------------------------|
34
- | esm.sh | `https://esm.sh/compress-utils/<algo>` |
35
- | jsDelivr | `https://cdn.jsdelivr.net/npm/compress-utils/dist/algorithms/<algo>/index.js` |
36
- | unpkg | `https://unpkg.com/compress-utils/dist/algorithms/<algo>/index.js` |
29
+ | CDN | Per-algo URL |
30
+ |----------|-------------------------------------------------------------------------------|
31
+ | esm.sh | `https://esm.sh/compress-utils/<algo>` |
32
+ | jsDelivr | `https://cdn.jsdelivr.net/npm/compress-utils/dist/algorithms/<algo>/index.js` |
33
+ | unpkg | `https://unpkg.com/compress-utils/dist/algorithms/<algo>/index.js` |
37
34
 
38
35
  ## Quick start
39
36
 
40
- Each algorithm is its own subpath import. Pick the one you need; the rest stay out of your bundle.
37
+ Each algorithm is its own subpath import. Pick the one you need, and the rest stay out of your bundle.
41
38
 
42
39
  ```ts
43
40
  import { compress, decompress } from "compress-utils/zstd";
44
41
 
45
- const input = new TextEncoder().encode("the quick brown fox " .repeat(50));
42
+ const input = new TextEncoder().encode("the quick brown fox ".repeat(50));
46
43
 
47
44
  const compressed = await compress(input, { level: 9 });
48
45
  const restored = await decompress(compressed);
49
46
  ```
50
47
 
51
- Available subpaths: `compress-utils/zstd`, `/brotli`, `/zlib`, `/bz2`, `/lz4`, `/xz`, `/snappy`, `/gzip`. Identical surface across all eight. Each also has `/<algo>/decompress` and `/<algo>/compress` variants that ship only one direction for a much smaller `.wasm` — see [Bundle size](#bundle-size).
48
+ Available subpaths: `compress-utils/zstd`, `/brotli`, `/zlib`, `/bz2`, `/lz4`, `/xz`, `/snappy`, `/gzip`, plus the raw block formats `/deflate`, `/lz4_raw` and `/lzo/decompress`. The surface is identical across all of them. Each also has `/<algo>/decompress` and `/<algo>/compress` variants that ship only one direction for a much smaller `.wasm`; see [Bundle size](#bundle-size).
49
+
50
+ ## Supported algorithms
51
+
52
+ <!-- BEGIN:algorithms -->
53
+ <!-- Generated by tools/check-readmes.py from docs/readme/manifest.json. Edit the manifest and run `tools/check-readmes.py --fix`, not this block. -->
54
+
55
+ | Algorithm | Subpath | Wire format |
56
+ |-----------|---------------------------------|------------------------------------------------------------------------------------------|
57
+ | Zstandard | `compress-utils/zstd` | ZSTD frame with content size |
58
+ | Brotli | `compress-utils/brotli` | Raw Brotli stream |
59
+ | zlib | `compress-utils/zlib` | zlib wrapper (RFC 1950) |
60
+ | gzip | `compress-utils/gzip` | gzip stream (RFC 1952) |
61
+ | bzip2 | `compress-utils/bz2` | bzip2 stream |
62
+ | LZ4 | `compress-utils/lz4` | LZ4 frame (interoperable with the `lz4` CLI and `.lz4` files) |
63
+ | XZ / LZMA | `compress-utils/xz` | XZ stream with CRC64 |
64
+ | Snappy | `compress-utils/snappy` | Raw Snappy block (interoperable with reference snappy and python-snappy) |
65
+ | DEFLATE | `compress-utils/deflate` | Raw DEFLATE (RFC 1951), no wrapper |
66
+ | LZ4 block | `compress-utils/lz4_raw` | Raw LZ4 block, no frame or size prefix (one-shot compression, incremental decompression) |
67
+ | LZO1X | `compress-utils/lzo/decompress` | Raw LZO1X block (decompression only) |
68
+ <!-- END:algorithms -->
69
+
70
+ Imports are independent: `import "compress-utils/zstd"` and `import "compress-utils/brotli"` pull in two separate `.wasm` modules, not a combined bundle. Files are marked `"sideEffects": false` so unused exports are tree-shaken aggressively. For per-module `.wasm` sizes, and the smaller decode-only and encode-only builds, see [Bundle size](#bundle-size).
71
+
72
+ ### Raw blocks and output capacity
73
+
74
+ Raw block formats such as those inside Parquet and ORC pages don't record their decompressed size. Pass `expectedSize`, an upper bound on the output, and the result holds only the bytes actually decoded:
75
+
76
+ ```ts
77
+ import { decompress } from "compress-utils/lz4_raw";
78
+
79
+ const page = await decompress(block, { expectedSize: uncompressedPageSize });
80
+ ```
81
+
82
+ Without `expectedSize`, `lz4_raw` blocks are decoded with the incremental stream decoder, which is much slower, so pass it when you know the size. Every other algorithm accepts it too, which skips a sizing pass and decodes straight into a buffer of that size.
83
+
84
+ ## Streaming
52
85
 
53
86
  ### Web Streams
54
87
 
@@ -72,78 +105,111 @@ chunks.push(cs.finish());
72
105
  // cs is destroyed automatically on scope exit (TS 5.2+ / Node 22+).
73
106
  ```
74
107
 
75
- If `using` isn't available in your toolchain, call `cs.destroy()` explicitly — or rely on the GC backstop (a `FinalizationRegistry` frees the C-side handle eventually).
108
+ If `using` isn't available in your toolchain, call `cs.destroy()` explicitly, or rely on the GC backstop: a `FinalizationRegistry` frees the C-side handle eventually.
76
109
 
77
- ## Supported algorithms
110
+ ### Stopping at the end of a stream
78
111
 
79
- | Algorithm | Subpath | Wire format produced |
80
- |-----------|--------------------------|--------------------------------------------|
81
- | zlib | `compress-utils/zlib` | zlib wrapper (RFC 1950) |
82
- | bzip2 | `compress-utils/bz2` | bzip2 stream |
83
- | XZ/LZMA | `compress-utils/xz` | XZ stream with CRC64 |
84
- | LZ4 | `compress-utils/lz4` | LZ4 frame (compatible with `.lz4` files) |
85
- | Zstandard | `compress-utils/zstd` | ZSTD frame with content size |
86
- | Brotli | `compress-utils/brotli` | raw Brotli stream |
87
- | Snappy | `compress-utils/snappy` | Raw Snappy block |
88
- | gzip | `compress-utils/gzip` | gzip stream (RFC 1952) |
89
- | LZO | `compress-utils/lzo/decompress` | Raw LZO1X block (decompress only; pass `{expectedSize}` as output capacity) |
112
+ By default a decoder decodes concatenated frames (zstd, LZ4, gzip, xz) as one stream. To read one compressed stream followed by other data, such as the next message on a socket or a container's own bytes, create the decoder with `{ singleStream: true }`. It stops at the end of the first frame, sets `eof`, and returns the input bytes written after the end in `unusedData`:
90
113
 
91
- Imports are independent — `import "compress-utils/zstd"` and `import "compress-utils/brotli"` pull in two separate `.wasm` modules, not a combined bundle. Files marked `"sideEffects": false` so unused exports are tree-shaken aggressively. For per-module `.wasm` sizes (and the smaller decode-only / encode-only builds), see **[Bundle size](#bundle-size)**.
114
+ ```ts
115
+ import { createDecompressStream } from "compress-utils/zstd";
92
116
 
93
- ## Bundle size
117
+ using ds = await createDecompressStream({ singleStream: true });
118
+ const message = ds.write(received); // decodes up to the end of the frame
119
+ if (ds.eof) {
120
+ const rest = ds.unusedData; // bytes after the frame, e.g. the next message
121
+ }
122
+ ```
123
+
124
+ Once `eof` is true, writing more data throws `CompressError` with code `10` (stream finished) and leaves `unusedData` unchanged; empty writes and `finish()` return empty output. Leading zstd/LZ4 skippable frames are skipped. Snappy emits nothing until its block is complete. Raw LZ4 (which has no end marker) and LZO don't support it and throw `CompressError` with code `5`. `decompressionStream()` doesn't take the option: a `TransformStream` has no way to hand back the bytes after the end, so use `createDecompressStream` for this.
125
+
126
+ ## Compression levels
127
+
128
+ Every algorithm accepts a `level` from **1 (fastest) to 10 (smallest)**. The binding maps that to each algorithm's native range internally, so you don't need to know that Zstandard goes 1–22 and zlib goes 1–9. The default is `5`.
129
+
130
+ ```ts
131
+ await compress(input, { level: 1 }); // fastest
132
+ await compress(input, { level: 10 }); // smallest
133
+ ```
94
134
 
95
- Importing `compress-utils/<algo>` gives you the **full** codec — compress *and* decompress. If you only need one direction (a browser that just *decompresses* fetched assets is the common case), import a directional subpath and the other half is dead-stripped from the `.wasm` entirely:
135
+ ## Errors and limits
136
+
137
+ Every failure throws a `CompressError`, which carries the underlying C status code and the algorithm name:
96
138
 
97
139
  ```ts
98
- // decoder only, 90 KB
99
- import { decompress } from "compress-utils/zstd/decompress";
140
+ import { compress, decompress, CompressError } from "compress-utils/zstd";
100
141
 
101
- // or, encoder only:
102
- import { compress } from "compress-utils/zstd/compress";
142
+ try {
143
+ await decompress(garbage);
144
+ } catch (e) {
145
+ if (e instanceof CompressError) console.error(e.algorithm, e.code, e.message);
146
+ }
103
147
  ```
104
148
 
105
- - **`/decompress`** exposes `decompress`, `createDecompressStream`, `decompressionStream`, `setMaxDecompressedSize`, `version`.
106
- - **`/compress`** exposes `compress`, `createCompressStream`, `compressionStream`, `version`.
107
- - The default subpath keeps **both**
149
+ `await version()` returns the library version (for example `"0.11.0"`), and `await setMaxDecompressedSize(bytes)` bounds one-shot decompression (default 1 GiB; `0` = unbounded). Both are exported from every subpath that includes decompression.
108
150
 
109
- Comparison of the gzipped sizes:
151
+ ## Preloading and synchronous calls
110
152
 
111
- | algo | full | decompress-only | compress-only |
112
- |--------|--------------:|----------------------:|----------------------:|
113
- | zstd | 128K | 36K | 106K |
114
- | brotli | 169K | 84K | 154K |
115
- | lz4 | 39K | 15K | 35K |
116
- | bz2 | 33K | 22K | 25K |
117
- | xz | 62K | 43K | 51K |
118
- | zlib | 33K | 25K | 26K |
119
- | snappy | 36K | 32K | 28K |
120
- | gzip | 80K | 52K | 60K |
153
+ Each algorithm and direction-specific subpath exports `preload()`. It loads and initializes that subpath's WASM module once, and concurrent calls share initialization. A failed initialization can be retried. No codec work is performed by preload.
121
154
 
122
- The `.wasm` is the bulk of what ships; the JS glue is a few KB, shared, and tree-shaken to the methods you import.
155
+ ```ts
156
+ import { preload, compressSync, decompressSync } from "compress-utils/zlib";
157
+ await preload();
158
+ const compressed = compressSync(new TextEncoder().encode("hello"));
159
+ const restored = decompressSync(compressed);
160
+ ```
123
161
 
124
- ## Compression levels
162
+ `compressSync`, `decompressSync`, `createCompressStreamSync`, and `createDecompressStreamSync` are available for the directions exposed by the subpath. They throw with a `preload()` instruction before initialization completes. Existing asynchronous APIs initialize automatically and also enable subsequent synchronous calls. Initializing one subpath does not initialize another, because encoder and decoder subpaths use different WASM modules.
125
163
 
126
- Every algorithm accepts a `level` from **1 (fastest) to 10 (smallest)**. The binding maps that to each algorithm's native range internally — you don't need to know that Zstandard goes 1–22 or zlib goes 1–9. Defaults to `5`.
164
+ ## Concurrency
165
+
166
+ Each WASM module instance runs on the thread that loaded it, so nothing is shared between workers: every Worker initializes its own instance and keeps its own streams. Synchronous calls block the calling thread, so run expensive ones in a Worker. A stream handle holds state inside its module instance, so feed each stream from one logical flow rather than from interleaved callers.
167
+
168
+ ## Bundle size
169
+
170
+ Importing `compress-utils/<algo>` gives you the **full** codec, compress *and* decompress. If you only need one direction (a browser that just *decompresses* fetched assets is the common case), import a directional subpath and the other half is dead-stripped from the `.wasm` entirely:
127
171
 
128
172
  ```ts
129
- await compress(input, { level: 1 }); // fastest
130
- await compress(input, { level: 10 }); // smallest
173
+ // decoder only, 36 KB gzipped for zstd
174
+ import { decompress } from "compress-utils/zstd/decompress";
175
+
176
+ // or, encoder only:
177
+ import { compress } from "compress-utils/zstd/compress";
131
178
  ```
132
179
 
180
+ - **`/decompress`** exposes `decompress`, `createDecompressStream`, `decompressionStream`, `setMaxDecompressedSize` and `version`.
181
+ - **`/compress`** exposes `compress`, `createCompressStream`, `compressionStream` and `version`.
182
+ - The default subpath keeps **both**.
183
+
184
+ Gzipped `.wasm` sizes:
185
+
186
+ | algo | full | decompress-only | compress-only |
187
+ |--------|-----:|----------------:|--------------:|
188
+ | zstd | 128K | 36K | 106K |
189
+ | brotli | 169K | 84K | 154K |
190
+ | lz4 | 39K | 15K | 35K |
191
+ | bz2 | 33K | 22K | 25K |
192
+ | xz | 62K | 43K | 51K |
193
+ | zlib | 33K | 25K | 26K |
194
+ | snappy | 36K | 32K | 28K |
195
+ | gzip | 80K | 52K | 60K |
196
+
197
+ The `.wasm` is the bulk of what ships. The JS glue is a few KB, shared, and tree-shaken to the methods you import.
198
+
133
199
  ## Runtime support
134
200
 
135
201
  Tested in CI on every release:
136
202
 
137
- | Runtime | Status |
138
- |----------------------|--------|
139
- | Node 20, 22, 24 | ✅ |
140
- | Bun | ✅ |
141
- | Deno 2.x | ✅ |
142
- | Chromium / Firefox / WebKit (Playwright) | ✅ |
203
+ | Runtime | Status |
204
+ |------------------------------------------|--------|
205
+ | Node 20, 22, 24 | ✅ |
206
+ | Bun | ✅ |
207
+ | Deno 2.x | ✅ |
208
+ | Chromium / Firefox / WebKit (Playwright) | ✅ |
143
209
 
144
210
  ## TypeScript
145
211
 
146
- The package is TypeScript-first. `.d.ts` files ship alongside the JS for every subpath; no `@types/` package needed.
212
+ The package is TypeScript-first. `.d.ts` files ship alongside the JS for every subpath, so no `@types/` package is needed.
147
213
 
148
214
  ```ts
149
215
  import { compress, type CompressOptions, type CompressError } from "compress-utils/zstd";
@@ -152,26 +218,9 @@ const opts: CompressOptions = { level: 7 };
152
218
  const compressed: Uint8Array = await compress(input, opts);
153
219
  ```
154
220
 
155
- ## Preloading and synchronous calls
156
-
157
- Each algorithm and direction-specific subpath exports `preload()`. It loads and
158
- initializes that subpath's WASM module once; concurrent calls share initialization.
159
- A failed initialization can be retried. No codec work is performed by preload.
160
-
161
- ```ts
162
- import { preload, compressSync, decompressSync } from "compress-utils/zlib";
163
- await preload();
164
- const compressed = compressSync(new TextEncoder().encode("hello"));
165
- const restored = decompressSync(compressed);
166
- ```
221
+ ## Performance
167
222
 
168
- `compressSync`, `decompressSync`, `createCompressStreamSync`, and
169
- `createDecompressStreamSync` are available for the directions exposed by the
170
- subpath. They throw with a `preload()` instruction before initialization completes.
171
- Existing asynchronous APIs initialize automatically and also enable subsequent
172
- synchronous calls. Initializing one subpath does not initialize another: encoder
173
- and decoder subpaths use different WASM modules. Sync calls block the calling
174
- thread; use a worker for expensive operations.
223
+ Overhead versus native C is **0.60–0.84× on compress and 0.50–1.00× on decompress**. WASM is the slowest binding across the board: zstd and brotli decode are the worst cases because they lean on native SIMD, while lz4 decode is memory-bound and costs nothing extra in the sandbox. The reasons to choose this binding are portability, one API in every runtime, and the small per-codec bundles above, rather than beating native `node:zlib`. Compression ratio is byte-identical to every other binding. See the [language comparison](https://github.com/dupontcyborg/compress-utils/blob/main/benchmarks/README.md#language-comparison) for methodology and the full chart.
175
224
 
176
225
  ## License
177
226
 
@@ -179,4 +228,4 @@ MIT. See [LICENSE](https://github.com/dupontcyborg/compress-utils/blob/main/LICE
179
228
 
180
229
  ---
181
230
 
182
- Built by [Nico Dupont](https://nico.codes).
231
+ Part of [compress-utils](https://github.com/dupontcyborg/compress-utils). Built by [Nico Dupont](https://nico.codes).
@@ -184,7 +184,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
184
184
 
185
185
  ## XZ Utils (liblzma)
186
186
 
187
- - **Source**: https://github.com/tukaani-project/xz at `v5.8.3` (`third_party/xz/`)
187
+ - **Source**: https://github.com/tukaani-project/xz at `v5.8.4` (`third_party/xz/`)
188
188
  - **License**: 0BSD
189
189
  - **Note**: Only liblzma is included; it is under the BSD Zero Clause License.
190
190
 
Binary file
@@ -4,11 +4,11 @@ export declare const compressSync: (input: Uint8Array, opts?: import("./index.js
4
4
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
5
5
  /** Synchronous counterpart; requires completed preload(). */
6
6
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
7
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
7
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
8
8
  /** Initializes this independently loaded WASM subpath. */
9
9
  export declare const preload: () => Promise<void>;
10
10
  export declare const version: () => Promise<string>;
11
11
  export { CompressError } from "../../../core/types.js";
12
- export type { CompressOptions, AlgorithmName } from "../../../core/types.js";
12
+ export type { CompressOptions, CompressionStreamOptions, AlgorithmName, } from "../../../core/types.js";
13
13
  export type { CompressStream } from "../../../core/dispatch.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/brotli/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/brotli/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,aAAa,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,15 +1,15 @@
1
1
  export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
2
2
  /** Synchronous counterpart; requires completed preload(). */
3
3
  export declare const decompressSync: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Uint8Array;
4
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
4
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
5
5
  /** Synchronous counterpart; requires completed preload(). */
6
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
6
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
7
7
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
8
8
  /** Initializes this independently loaded WASM subpath. */
9
9
  export declare const preload: () => Promise<void>;
10
10
  export declare const version: () => Promise<string>;
11
11
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
12
12
  export { CompressError } from "../../../core/types.js";
13
- export type { DecompressOptions, AlgorithmName } from "../../../core/types.js";
13
+ export type { DecompressOptions, DecompressStreamOptions, AlgorithmName } from "../../../core/types.js";
14
14
  export type { DecompressStream } from "../../../core/dispatch.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/brotli/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/brotli/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxG,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -7,16 +7,16 @@ export declare const decompressSync: (input: Uint8Array, opts?: import("./index.
7
7
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
8
8
  /** Synchronous counterpart; requires completed preload(). */
9
9
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
10
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
10
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
11
11
  /** Synchronous counterpart; requires completed preload(). */
12
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
13
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
12
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
13
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
14
14
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
15
15
  /** Initializes this independently loaded WASM subpath. */
16
16
  export declare const preload: () => Promise<void>;
17
17
  export declare const version: () => Promise<string>;
18
18
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
19
19
  export { CompressError } from "../../core/types.js";
20
- export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
20
+ export type { CompressOptions, CompressionStreamOptions, DecompressOptions, DecompressStreamOptions, AlgorithmName, } from "../../core/types.js";
21
21
  export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/brotli/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/brotli/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
Binary file
@@ -4,11 +4,11 @@ export declare const compressSync: (input: Uint8Array, opts?: import("./index.js
4
4
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
5
5
  /** Synchronous counterpart; requires completed preload(). */
6
6
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
7
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
7
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
8
8
  /** Initializes this independently loaded WASM subpath. */
9
9
  export declare const preload: () => Promise<void>;
10
10
  export declare const version: () => Promise<string>;
11
11
  export { CompressError } from "../../../core/types.js";
12
- export type { CompressOptions, AlgorithmName } from "../../../core/types.js";
12
+ export type { CompressOptions, CompressionStreamOptions, AlgorithmName, } from "../../../core/types.js";
13
13
  export type { CompressStream } from "../../../core/dispatch.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/bz2/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/bz2/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,aAAa,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,15 +1,15 @@
1
1
  export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
2
2
  /** Synchronous counterpart; requires completed preload(). */
3
3
  export declare const decompressSync: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Uint8Array;
4
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
4
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
5
5
  /** Synchronous counterpart; requires completed preload(). */
6
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
6
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
7
7
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
8
8
  /** Initializes this independently loaded WASM subpath. */
9
9
  export declare const preload: () => Promise<void>;
10
10
  export declare const version: () => Promise<string>;
11
11
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
12
12
  export { CompressError } from "../../../core/types.js";
13
- export type { DecompressOptions, AlgorithmName } from "../../../core/types.js";
13
+ export type { DecompressOptions, DecompressStreamOptions, AlgorithmName } from "../../../core/types.js";
14
14
  export type { DecompressStream } from "../../../core/dispatch.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/bz2/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/bz2/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxG,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -7,16 +7,16 @@ export declare const decompressSync: (input: Uint8Array, opts?: import("./index.
7
7
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
8
8
  /** Synchronous counterpart; requires completed preload(). */
9
9
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
10
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
10
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
11
11
  /** Synchronous counterpart; requires completed preload(). */
12
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
13
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
12
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
13
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
14
14
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
15
15
  /** Initializes this independently loaded WASM subpath. */
16
16
  export declare const preload: () => Promise<void>;
17
17
  export declare const version: () => Promise<string>;
18
18
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
19
19
  export { CompressError } from "../../core/types.js";
20
- export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
20
+ export type { CompressOptions, CompressionStreamOptions, DecompressOptions, DecompressStreamOptions, AlgorithmName, } from "../../core/types.js";
21
21
  export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/bz2/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/bz2/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -2,10 +2,10 @@ export declare const compress: (input: Uint8Array, opts?: import("./index.js").C
2
2
  export declare const compressSync: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Uint8Array;
3
3
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
4
4
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
5
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
5
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
6
6
  export declare const preload: () => Promise<void>;
7
7
  export declare const version: () => Promise<string>;
8
8
  export { CompressError } from "../../../core/types.js";
9
- export type { CompressOptions, AlgorithmName } from "../../../core/types.js";
9
+ export type { CompressOptions, CompressionStreamOptions, AlgorithmName, } from "../../../core/types.js";
10
10
  export type { CompressStream } from "../../../core/dispatch.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/deflate/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/deflate/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,aAAa,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,12 +1,12 @@
1
1
  export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
2
2
  export declare const decompressSync: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Uint8Array;
3
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
4
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
3
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
4
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
5
5
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
6
6
  export declare const preload: () => Promise<void>;
7
7
  export declare const version: () => Promise<string>;
8
8
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
9
9
  export { CompressError } from "../../../core/types.js";
10
- export type { DecompressOptions, AlgorithmName } from "../../../core/types.js";
10
+ export type { DecompressOptions, DecompressStreamOptions, AlgorithmName } from "../../../core/types.js";
11
11
  export type { DecompressStream } from "../../../core/dispatch.js";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/deflate/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC/E,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/deflate/decompress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxG,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -4,14 +4,14 @@ export declare const decompress: (input: Uint8Array, opts?: import("./index.js")
4
4
  export declare const decompressSync: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Uint8Array;
5
5
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
6
6
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
7
- export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
8
- export declare const createDecompressStreamSync: () => import("./index.js").DecompressStream;
9
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
7
+ export declare const createDecompressStream: (opts?: import("./index.js").DecompressStreamOptions) => Promise<import("./index.js").DecompressStream>;
8
+ export declare const createDecompressStreamSync: (opts?: import("./index.js").DecompressStreamOptions) => import("./index.js").DecompressStream;
9
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
10
10
  export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
11
11
  export declare const preload: () => Promise<void>;
12
12
  export declare const version: () => Promise<string>;
13
13
  export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
14
14
  export { CompressError } from "../../core/types.js";
15
- export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
15
+ export type { CompressOptions, CompressionStreamOptions, DecompressOptions, DecompressStreamOptions, AlgorithmName, } from "../../core/types.js";
16
16
  export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/deflate/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,0BAA0B,6CAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC7F,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/deflate/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,cAAc,kFAA0B,CAAC;AACtD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,sBAAsB,yGAAkC,CAAC;AACtE,eAAO,MAAM,0BAA0B,gGAAsC,CAAC;AAC9E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AACxC,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,GAChB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -4,11 +4,11 @@ export declare const compressSync: (input: Uint8Array, opts?: import("./index.js
4
4
  export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
5
5
  /** Synchronous counterpart; requires completed preload(). */
6
6
  export declare const createCompressStreamSync: (opts?: import("./index.js").CompressOptions) => import("./index.js").CompressStream;
7
- export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
7
+ export declare const compressionStream: (opts?: import("./index.js").CompressionStreamOptions) => TransformStream<Uint8Array, Uint8Array>;
8
8
  /** Initializes this independently loaded WASM subpath. */
9
9
  export declare const preload: () => Promise<void>;
10
10
  export declare const version: () => Promise<string>;
11
11
  export { CompressError } from "../../../core/types.js";
12
- export type { CompressOptions, AlgorithmName } from "../../../core/types.js";
12
+ export type { CompressOptions, CompressionStreamOptions, AlgorithmName, } from "../../../core/types.js";
13
13
  export type { CompressStream } from "../../../core/dispatch.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/gzip/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/algorithms/gzip/compress/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,6DAA6D;AAC7D,eAAO,MAAM,YAAY,gFAAwB,CAAC;AAClD,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,sFAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB,mGAA6B,CAAC;AAC5D,0DAA0D;AAC1D,eAAO,MAAM,OAAO,qBAAmB,CAAC;AACxC,eAAO,MAAM,OAAO,uBAAmB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACR,eAAe,EACf,wBAAwB,EACxB,aAAa,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}