compress-utils 0.7.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/algorithms/brotli/brotli.wasm +0 -0
- package/dist/algorithms/brotli/index.d.ts +12 -0
- package/dist/algorithms/brotli/index.d.ts.map +1 -0
- package/dist/algorithms/brotli/index.js +17 -0
- package/dist/algorithms/brotli/index.js.map +1 -0
- package/dist/algorithms/bz2/bz2.wasm +0 -0
- package/dist/algorithms/bz2/index.d.ts +12 -0
- package/dist/algorithms/bz2/index.d.ts.map +1 -0
- package/dist/algorithms/bz2/index.js +17 -0
- package/dist/algorithms/bz2/index.js.map +1 -0
- package/dist/algorithms/lz4/index.d.ts +12 -0
- package/dist/algorithms/lz4/index.d.ts.map +1 -0
- package/dist/algorithms/lz4/index.js +17 -0
- package/dist/algorithms/lz4/index.js.map +1 -0
- package/dist/algorithms/lz4/lz4.wasm +0 -0
- package/dist/algorithms/xz/index.d.ts +12 -0
- package/dist/algorithms/xz/index.d.ts.map +1 -0
- package/dist/algorithms/xz/index.js +17 -0
- package/dist/algorithms/xz/index.js.map +1 -0
- package/dist/algorithms/xz/xz.wasm +0 -0
- package/dist/algorithms/zlib/index.d.ts +12 -0
- package/dist/algorithms/zlib/index.d.ts.map +1 -0
- package/dist/algorithms/zlib/index.js +17 -0
- package/dist/algorithms/zlib/index.js.map +1 -0
- package/dist/algorithms/zlib/zlib.wasm +0 -0
- package/dist/algorithms/zstd/index.d.ts +12 -0
- package/dist/algorithms/zstd/index.d.ts.map +1 -0
- package/dist/algorithms/zstd/index.js +17 -0
- package/dist/algorithms/zstd/index.js.map +1 -0
- package/dist/algorithms/zstd/zstd.wasm +0 -0
- package/dist/core/algorithm.d.ts +17 -0
- package/dist/core/algorithm.d.ts.map +1 -0
- package/dist/core/algorithm.js +19 -0
- package/dist/core/algorithm.js.map +1 -0
- package/dist/core/dispatch.d.ts +83 -0
- package/dist/core/dispatch.d.ts.map +1 -0
- package/dist/core/dispatch.js +370 -0
- package/dist/core/dispatch.js.map +1 -0
- package/dist/core/loader.d.ts +47 -0
- package/dist/core/loader.d.ts.map +1 -0
- package/dist/core/loader.js +121 -0
- package/dist/core/loader.js.map +1 -0
- package/dist/core/resolve-browser.d.ts +12 -0
- package/dist/core/resolve-browser.d.ts.map +1 -0
- package/dist/core/resolve-browser.js +11 -0
- package/dist/core/resolve-browser.js.map +1 -0
- package/dist/core/resolve-default.d.ts +11 -0
- package/dist/core/resolve-default.d.ts.map +1 -0
- package/dist/core/resolve-default.js +27 -0
- package/dist/core/resolve-default.js.map +1 -0
- package/dist/core/resolve-node.d.ts +13 -0
- package/dist/core/resolve-node.d.ts.map +1 -0
- package/dist/core/resolve-node.js +13 -0
- package/dist/core/resolve-node.js.map +1 -0
- package/dist/core/types.d.ts +54 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +47 -0
- package/dist/core/types.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Nicolas Dupont
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# compress-utils
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/compress-utils)
|
|
4
|
+
[](https://www.npmjs.com/package/compress-utils)
|
|
5
|
+
[](https://www.npmjs.com/package/compress-utils)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Unified WebAssembly bindings for six compression algorithms — Brotli, bzip2, LZ4, XZ/LZMA, zlib, and Zstandard. Same API for every algorithm, in every JavaScript runtime, with per-algorithm imports so bundlers ship only what you use.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install compress-utils
|
|
14
|
+
# or: pnpm add / yarn add / bun add / deno add npm:compress-utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
No native dependencies, no `postinstall` scripts. Pure WebAssembly. TypeScript types are bundled.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
Each algorithm is its own subpath import. Pick the one you need; the rest stay out of your bundle.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { compress, decompress } from "compress-utils/zstd";
|
|
25
|
+
|
|
26
|
+
const input = new TextEncoder().encode("the quick brown fox " .repeat(50));
|
|
27
|
+
|
|
28
|
+
const compressed = await compress(input, { level: 9 });
|
|
29
|
+
const restored = await decompress(compressed);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Available subpaths: `compress-utils/zstd`, `/brotli`, `/zlib`, `/bz2`, `/lz4`, `/xz`. Identical surface across all six.
|
|
33
|
+
|
|
34
|
+
### Web Streams
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { compressionStream, decompressionStream } from "compress-utils/zstd";
|
|
38
|
+
|
|
39
|
+
await fetch("/big-file.json")
|
|
40
|
+
.then(r => r.body!.pipeThrough(compressionStream({ level: 3 })))
|
|
41
|
+
.then(s => s.pipeTo(uploadDestination));
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Manual streaming (with `using` for auto-cleanup)
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { createCompressStream } from "compress-utils/brotli";
|
|
48
|
+
|
|
49
|
+
using cs = await createCompressStream({ level: 5 });
|
|
50
|
+
const chunks: Uint8Array[] = [];
|
|
51
|
+
for (const chunk of input) chunks.push(cs.write(chunk));
|
|
52
|
+
chunks.push(cs.finish());
|
|
53
|
+
// cs is destroyed automatically on scope exit (TS 5.2+ / Node 22+).
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
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).
|
|
57
|
+
|
|
58
|
+
## Supported algorithms
|
|
59
|
+
|
|
60
|
+
| Algorithm | Subpath | Approximate `.wasm` size | Wire format produced |
|
|
61
|
+
|-----------|--------------------------|---------------------------|--------------------------------------------|
|
|
62
|
+
| zlib | `compress-utils/zlib` | 80 KB | zlib wrapper (RFC 1950) |
|
|
63
|
+
| bzip2 | `compress-utils/bz2` | 95 KB | bzip2 stream |
|
|
64
|
+
| XZ/LZMA | `compress-utils/xz` | 135 KB | XZ stream with CRC64 |
|
|
65
|
+
| LZ4 | `compress-utils/lz4` | 140 KB | LZ4 frame (compatible with `.lz4` files) |
|
|
66
|
+
| Zstandard | `compress-utils/zstd` | 545 KB | ZSTD frame with content size |
|
|
67
|
+
| Brotli | `compress-utils/brotli` | 730 KB | raw Brotli stream |
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
## Other helpful APIs
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import {
|
|
75
|
+
version,
|
|
76
|
+
setMaxDecompressedSize,
|
|
77
|
+
CompressError,
|
|
78
|
+
} from "compress-utils/zstd";
|
|
79
|
+
|
|
80
|
+
await version(); // "0.1.0"
|
|
81
|
+
await setMaxDecompressedSize(256 * 1024 ** 2);
|
|
82
|
+
// bound one-shot decompression (default: 1 GiB; 0 = unbounded)
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
await decompress(garbage);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
if (e instanceof CompressError) {
|
|
88
|
+
console.log(e.algorithm, e.code, e.message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Compression levels
|
|
94
|
+
|
|
95
|
+
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`.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
await compress(input, { level: 1 }); // fastest
|
|
99
|
+
await compress(input, { level: 10 }); // smallest
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Runtime support
|
|
103
|
+
|
|
104
|
+
Tested in CI on every release:
|
|
105
|
+
|
|
106
|
+
| Runtime | Status |
|
|
107
|
+
|----------------------|--------|
|
|
108
|
+
| Node 20, 22 | ✅ |
|
|
109
|
+
| Bun | ✅ |
|
|
110
|
+
| Deno 2.x | ✅ |
|
|
111
|
+
| Chromium / Firefox / WebKit (Playwright) | ✅ |
|
|
112
|
+
|
|
113
|
+
The package exposes the [`browser`](https://nodejs.org/api/packages.html#community-conditions-definitions), `node`, `deno`, and `bun` export conditions:
|
|
114
|
+
|
|
115
|
+
- Browser, Deno, and Bun consumers get a `fetch`-based loader → `WebAssembly.instantiateStreaming` (concurrent download + compile).
|
|
116
|
+
- Node consumers get a `fs.readFile`-based loader (Node's built-in `fetch` doesn't handle `file://`).
|
|
117
|
+
|
|
118
|
+
You don't need to configure anything — the right entry is picked automatically. The browser entry has zero references to `node:*` modules, so it bundles cleanly under Vite, esbuild, webpack 5, Rollup, etc.
|
|
119
|
+
|
|
120
|
+
## TypeScript
|
|
121
|
+
|
|
122
|
+
The package is TypeScript-first. `.d.ts` files ship alongside the JS for every subpath; no `@types/` package needed.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { compress, type CompressOptions, type CompressError } from "compress-utils/zstd";
|
|
126
|
+
|
|
127
|
+
const opts: CompressOptions = { level: 7 };
|
|
128
|
+
const compressed: Uint8Array = await compress(input, opts);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Performance notes
|
|
132
|
+
|
|
133
|
+
- The first call on a given subpath instantiates the `.wasm` module (~5–20 ms depending on size). Subsequent calls reuse the same instance.
|
|
134
|
+
- Streaming compresses/decompresses in 64 KB chunks internally — multi-GB inputs don't hold the whole result in memory.
|
|
135
|
+
- The JS layer copies bytes into and out of WebAssembly linear memory rather than handing out views, so memory growth inside the codec can never invalidate a `Uint8Array` you hold.
|
|
136
|
+
- Browsers, Deno, and Bun get `WebAssembly.instantiateStreaming` — bytes compile while they download. Node uses the buffered path because its `fetch` doesn't speak `file://`.
|
|
137
|
+
|
|
138
|
+
## Bundler notes
|
|
139
|
+
|
|
140
|
+
Per-algorithm imports + `sideEffects: false` mean modern bundlers tree-shake aggressively. A consumer that imports only `compress-utils/zstd` ships exactly one `.wasm` and only the zstd-bound TypeScript glue.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT. See [LICENSE](https://github.com/dupontcyborg/compress-utils/blob/main/LICENSE).
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/brotli/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* brotli subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Brotli, "brotli", new URL("./brotli.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/brotli/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CACxE,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/bz2/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bz2 subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Bz2, "bz2", new URL("./bz2.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/bz2/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/lz4/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lz4 subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Lz4, "lz4", new URL("./lz4.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/lz4/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/D,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/xz/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xz subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Xz, "xz", new URL("./xz.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/xz/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5D,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/zlib/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zlib subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Zlib, "zlib", new URL("./zlib.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/zlib/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const compress: (input: Uint8Array, opts?: import("./index.js").CompressOptions) => Promise<Uint8Array>;
|
|
2
|
+
export declare const decompress: (input: Uint8Array, opts?: import("./index.js").DecompressOptions) => Promise<Uint8Array>;
|
|
3
|
+
export declare const createCompressStream: (opts?: import("./index.js").CompressOptions) => Promise<import("./index.js").CompressStream>;
|
|
4
|
+
export declare const createDecompressStream: () => Promise<import("./index.js").DecompressStream>;
|
|
5
|
+
export declare const compressionStream: (opts?: import("./index.js").CompressOptions) => TransformStream<Uint8Array, Uint8Array>;
|
|
6
|
+
export declare const decompressionStream: () => TransformStream<Uint8Array, Uint8Array>;
|
|
7
|
+
export declare const version: () => Promise<string>;
|
|
8
|
+
export declare const setMaxDecompressedSize: (bytes: number) => Promise<void>;
|
|
9
|
+
export { CompressError } from "../../core/types.js";
|
|
10
|
+
export type { CompressOptions, DecompressOptions, AlgorithmName } from "../../core/types.js";
|
|
11
|
+
export type { CompressStream, DecompressStream } from "../../core/dispatch.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/algorithms/zstd/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ,yFAAoB,CAAC;AAC1C,eAAO,MAAM,UAAU,2FAAsB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,+FAAgC,CAAC;AAClE,eAAO,MAAM,sBAAsB,sDAAkC,CAAC;AACtE,eAAO,MAAM,iBAAiB,0FAA6B,CAAC;AAC5D,eAAO,MAAM,mBAAmB,+CAA+B,CAAC;AAChE,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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zstd subpath. Resolver is selected via the package's `#resolver`
|
|
3
|
+
* subpath import — see ../../core/algorithm.ts and package.json `imports`.
|
|
4
|
+
*/
|
|
5
|
+
import { defineAlgorithm } from "../../core/algorithm.js";
|
|
6
|
+
import { Algorithm } from "../../core/types.js";
|
|
7
|
+
const bindings = /*#__PURE__*/ defineAlgorithm(Algorithm.Zstd, "zstd", new URL("./zstd.wasm", import.meta.url));
|
|
8
|
+
export const compress = bindings.compress;
|
|
9
|
+
export const decompress = bindings.decompress;
|
|
10
|
+
export const createCompressStream = bindings.createCompressStream;
|
|
11
|
+
export const createDecompressStream = bindings.createDecompressStream;
|
|
12
|
+
export const compressionStream = bindings.compressionStream;
|
|
13
|
+
export const decompressionStream = bindings.decompressionStream;
|
|
14
|
+
export const version = bindings.version;
|
|
15
|
+
export const setMaxDecompressedSize = bindings.setMaxDecompressedSize;
|
|
16
|
+
export { CompressError } from "../../core/types.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/algorithms/zstd/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,QAAQ,GAAG,aAAa,CAAC,eAAe,CAC1C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,oBAAoB,CAAC;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,sBAAsB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-algorithm binding factory.
|
|
3
|
+
*
|
|
4
|
+
* Each `algorithms/<algo>/index.ts` is a one-liner that calls this with its
|
|
5
|
+
* enum value + canonical name + co-located .wasm URL. The runtime resolver
|
|
6
|
+
* is selected via the package's `#resolver` subpath import (see
|
|
7
|
+
* package.json `imports`), so this file has no node-vs-browser branching.
|
|
8
|
+
*
|
|
9
|
+
* Exports are aliased back to module scope so tree-shaking works at the
|
|
10
|
+
* import-site granularity: a consumer pulling only `version` from this
|
|
11
|
+
* subpath still triggers `createBindings`, but bundlers can drop the
|
|
12
|
+
* unused stream constructors from the final bundle.
|
|
13
|
+
*/
|
|
14
|
+
import { createBindings } from "./dispatch.js";
|
|
15
|
+
import { Algorithm, type AlgorithmName } from "./types.js";
|
|
16
|
+
export declare function defineAlgorithm(algorithm: Algorithm, name: AlgorithmName, wasmUrl: URL): ReturnType<typeof createBindings>;
|
|
17
|
+
//# sourceMappingURL=algorithm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorithm.d.ts","sourceRoot":"","sources":["../../src/core/algorithm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3D,wBAAgB,eAAe,CAC3B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,aAAa,EACnB,OAAO,EAAE,GAAG,GACb,UAAU,CAAC,OAAO,cAAc,CAAC,CAEnC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-algorithm binding factory.
|
|
3
|
+
*
|
|
4
|
+
* Each `algorithms/<algo>/index.ts` is a one-liner that calls this with its
|
|
5
|
+
* enum value + canonical name + co-located .wasm URL. The runtime resolver
|
|
6
|
+
* is selected via the package's `#resolver` subpath import (see
|
|
7
|
+
* package.json `imports`), so this file has no node-vs-browser branching.
|
|
8
|
+
*
|
|
9
|
+
* Exports are aliased back to module scope so tree-shaking works at the
|
|
10
|
+
* import-site granularity: a consumer pulling only `version` from this
|
|
11
|
+
* subpath still triggers `createBindings`, but bundlers can drop the
|
|
12
|
+
* unused stream constructors from the final bundle.
|
|
13
|
+
*/
|
|
14
|
+
import { resolveWasm } from "#resolver";
|
|
15
|
+
import { createBindings } from "./dispatch.js";
|
|
16
|
+
export function defineAlgorithm(algorithm, name, wasmUrl) {
|
|
17
|
+
return createBindings(algorithm, name, wasmUrl, resolveWasm);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=algorithm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorithm.js","sourceRoot":"","sources":["../../src/core/algorithm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,UAAU,eAAe,CAC3B,SAAoB,EACpB,IAAmB,EACnB,OAAY;IAEZ,OAAO,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic JS→C ABI dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* Per-algorithm modules (algorithms/<algo>/index.ts) call `createBindings`
|
|
5
|
+
* with their algorithm enum + wasm URL; that factory returns the public
|
|
6
|
+
* surface (compress, decompress, streams, version, etc.) bound to a
|
|
7
|
+
* lazily-instantiated wasm module. The dispatcher itself doesn't ship in
|
|
8
|
+
* any user bundle — only the slice of it the algorithm uses, after
|
|
9
|
+
* tree-shaking.
|
|
10
|
+
*/
|
|
11
|
+
import { type WasmExports } from "./loader.js";
|
|
12
|
+
import { Algorithm, type AlgorithmName, type CompressOptions, type DecompressOptions } from "./types.js";
|
|
13
|
+
/** Tracks allocations so a single try/finally can free them all. */
|
|
14
|
+
declare class Arena {
|
|
15
|
+
private readonly exports;
|
|
16
|
+
private readonly ptrs;
|
|
17
|
+
constructor(exports: WasmExports);
|
|
18
|
+
alloc(bytes: number, algoName: AlgorithmName): number;
|
|
19
|
+
freeAll(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class Dispatcher {
|
|
22
|
+
readonly algorithm: Algorithm;
|
|
23
|
+
readonly algorithmName: AlgorithmName;
|
|
24
|
+
/** @internal */ readonly exports: WasmExports;
|
|
25
|
+
constructor(exports: WasmExports, algorithm: Algorithm, algorithmName: AlgorithmName);
|
|
26
|
+
version(): string;
|
|
27
|
+
setMaxDecompressedSize(bytes: number): void;
|
|
28
|
+
compress(input: Uint8Array, opts?: CompressOptions): Uint8Array;
|
|
29
|
+
decompress(input: Uint8Array, opts?: DecompressOptions): Uint8Array;
|
|
30
|
+
private decompressStreaming;
|
|
31
|
+
private tryProbeSize;
|
|
32
|
+
createCompressStream(opts?: CompressOptions): CompressStream;
|
|
33
|
+
createDecompressStream(): DecompressStream;
|
|
34
|
+
/** @internal */ writeBytes(ptr: number, src: Uint8Array): void;
|
|
35
|
+
/** @internal */ readBytes(ptr: number, len: number): Uint8Array;
|
|
36
|
+
/** @internal */ writeU32(ptr: number, value: number): void;
|
|
37
|
+
/** @internal */ readU32(ptr: number): number;
|
|
38
|
+
/** @internal */ newArena(): Arena;
|
|
39
|
+
}
|
|
40
|
+
declare abstract class StreamBase {
|
|
41
|
+
protected readonly dispatcher: Dispatcher;
|
|
42
|
+
protected handle: number;
|
|
43
|
+
protected finished: boolean;
|
|
44
|
+
private readonly cleanup;
|
|
45
|
+
constructor(dispatcher: Dispatcher, handle: number, destroyFn: (handle: number) => void);
|
|
46
|
+
protected ensureLive(): void;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
/** Symbol.dispose — enables `using stream = await create*()`. */
|
|
49
|
+
[Symbol.dispose](): void;
|
|
50
|
+
}
|
|
51
|
+
export declare class CompressStream extends StreamBase {
|
|
52
|
+
constructor(dispatcher: Dispatcher, handle: number);
|
|
53
|
+
write(chunk: Uint8Array): Uint8Array;
|
|
54
|
+
finish(): Uint8Array;
|
|
55
|
+
}
|
|
56
|
+
export declare class DecompressStream extends StreamBase {
|
|
57
|
+
constructor(dispatcher: Dispatcher, handle: number);
|
|
58
|
+
write(chunk: Uint8Array): Uint8Array;
|
|
59
|
+
finish(): Uint8Array;
|
|
60
|
+
}
|
|
61
|
+
export interface AlgorithmBindings {
|
|
62
|
+
compress(input: Uint8Array, opts?: CompressOptions): Promise<Uint8Array>;
|
|
63
|
+
decompress(input: Uint8Array, opts?: DecompressOptions): Promise<Uint8Array>;
|
|
64
|
+
createCompressStream(opts?: CompressOptions): Promise<CompressStream>;
|
|
65
|
+
createDecompressStream(): Promise<DecompressStream>;
|
|
66
|
+
/** TransformStream that compresses bytes as they flow through. */
|
|
67
|
+
compressionStream(opts?: CompressOptions): TransformStream<Uint8Array, Uint8Array>;
|
|
68
|
+
/** TransformStream that decompresses bytes as they flow through. */
|
|
69
|
+
decompressionStream(): TransformStream<Uint8Array, Uint8Array>;
|
|
70
|
+
/** Library version, e.g. "0.6.0". */
|
|
71
|
+
version(): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Cap on decompressed size (bytes) for the one-shot decompress path.
|
|
74
|
+
* Defaults to 1 GiB. Set 0 to disable. Streaming decompress is not
|
|
75
|
+
* affected — bound your own buffer there. Thread-local in C; in WASM
|
|
76
|
+
* it's effectively global to this module instance.
|
|
77
|
+
*/
|
|
78
|
+
setMaxDecompressedSize(bytes: number): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export type WasmResolver = (url: URL) => Promise<BufferSource | Response | PromiseLike<Response>>;
|
|
81
|
+
export declare function createBindings(algorithm: Algorithm, name: AlgorithmName, wasmUrl: URL, resolveWasm: WasmResolver): AlgorithmBindings;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/core/dispatch.ts"],"names":[],"mappings":"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"}
|