neozipkit 0.7.2 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -24
- package/WHATS_NEW.md +114 -0
- package/dist/browser/zstd-browser-shim.d.ts +28 -0
- package/dist/browser/zstd-browser-shim.d.ts.map +1 -0
- package/dist/browser/zstd-browser-shim.js +66 -0
- package/dist/browser/zstd-browser-shim.js.map +1 -0
- package/dist/browser-esm/index.js +1786 -41737
- package/dist/browser-esm/index.js.map +4 -4
- package/dist/browser-umd/index.js +1786 -41737
- package/dist/browser-umd/index.js.map +4 -4
- package/dist/browser-umd/index.min.js +3 -21
- package/dist/core/ZipCompress.d.ts +2 -7
- package/dist/core/ZipCompress.d.ts.map +1 -1
- package/dist/core/ZipCompress.js +45 -22
- package/dist/core/ZipCompress.js.map +1 -1
- package/dist/core/ZipDecompress.d.ts +1 -3
- package/dist/core/ZipDecompress.d.ts.map +1 -1
- package/dist/core/ZipDecompress.js +14 -9
- package/dist/core/ZipDecompress.js.map +1 -1
- package/dist/core/encryption/AesCrypto.d.ts +55 -11
- package/dist/core/encryption/AesCrypto.d.ts.map +1 -1
- package/dist/core/encryption/AesCrypto.js +223 -68
- package/dist/core/encryption/AesCrypto.js.map +1 -1
- package/dist/core/encryption/index.d.ts +1 -1
- package/dist/core/encryption/index.d.ts.map +1 -1
- package/dist/core/encryption/index.js +3 -1
- package/dist/core/encryption/index.js.map +1 -1
- package/dist/core/version.js +1 -1
- package/dist/node/LegacyZstd.d.ts +67 -0
- package/dist/node/LegacyZstd.d.ts.map +1 -0
- package/dist/node/LegacyZstd.js +209 -0
- package/dist/node/LegacyZstd.js.map +1 -0
- package/dist/node/ZipCompressNode.d.ts +9 -7
- package/dist/node/ZipCompressNode.d.ts.map +1 -1
- package/dist/node/ZipCompressNode.js +85 -46
- package/dist/node/ZipCompressNode.js.map +1 -1
- package/dist/node/ZipDecompressNode.d.ts +7 -3
- package/dist/node/ZipDecompressNode.d.ts.map +1 -1
- package/dist/node/ZipDecompressNode.js +51 -55
- package/dist/node/ZipDecompressNode.js.map +1 -1
- package/dist/node/ZipkitNode.d.ts +14 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -1
- package/dist/node/ZipkitNode.js +130 -39
- package/dist/node/ZipkitNode.js.map +1 -1
- package/dist/node/ZstdNode.d.ts +39 -0
- package/dist/node/ZstdNode.d.ts.map +1 -0
- package/dist/node/ZstdNode.js +171 -0
- package/dist/node/ZstdNode.js.map +1 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +11 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +10 -10
- package/src/browser/zstd-browser-shim.ts +76 -0
- package/src/core/ZipCompress.ts +57 -29
- package/src/core/ZipDecompress.ts +21 -10
- package/src/core/encryption/AesCrypto.ts +265 -86
- package/src/core/encryption/index.ts +1 -1
- package/src/core/version.ts +1 -1
- package/src/node/LegacyZstd.ts +270 -0
- package/src/node/ZipCompressNode.ts +107 -55
- package/src/node/ZipDecompressNode.ts +80 -66
- package/src/node/ZipkitNode.ts +150 -40
- package/src/node/ZstdNode.ts +155 -0
- package/src/node/index.ts +10 -0
- package/dist/core/ZstdManager.d.ts +0 -56
- package/dist/core/ZstdManager.d.ts.map +0 -1
- package/dist/core/ZstdManager.js +0 -144
- package/dist/core/ZstdManager.js.map +0 -1
- package/src/core/ZstdManager.ts +0 -165
package/dist/core/ZstdManager.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ZstdManager - Global Zstd Codec Manager
|
|
4
|
-
*
|
|
5
|
-
* This manager ensures safe usage of the Zstd WASM module across multiple instances.
|
|
6
|
-
*
|
|
7
|
-
* ## Why This Is Necessary
|
|
8
|
-
*
|
|
9
|
-
* The `@oneidentity/zstd-js` library uses a shared WASM module internally.
|
|
10
|
-
* While `ZstdInit()` returns different object references, they all share the same
|
|
11
|
-
* `ZstdSimple` implementation and WASM memory/heap.
|
|
12
|
-
*
|
|
13
|
-
* This means concurrent or improperly managed sequential operations can cause
|
|
14
|
-
* memory corruption because they're all operating on the same underlying WASM state.
|
|
15
|
-
*
|
|
16
|
-
* ## How It Works
|
|
17
|
-
*
|
|
18
|
-
* 1. Single initialization: WASM module is initialized once globally
|
|
19
|
-
* 2. Operation queuing: All compress/decompress operations are queued
|
|
20
|
-
* 3. Sequential execution: JavaScript's single-threaded nature ensures safe execution
|
|
21
|
-
* 4. Automatic initialization: Lazy initialization on first use
|
|
22
|
-
*
|
|
23
|
-
* ## Usage
|
|
24
|
-
*
|
|
25
|
-
* ```typescript
|
|
26
|
-
* import { ZstdManager } from './ZstdManager';
|
|
27
|
-
*
|
|
28
|
-
* // Compress
|
|
29
|
-
* const compressed = await ZstdManager.compress(data, level);
|
|
30
|
-
*
|
|
31
|
-
* // Decompress
|
|
32
|
-
* const decompressed = await ZstdManager.decompress(compressedData);
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ZstdManager = void 0;
|
|
37
|
-
const zstd_js_1 = require("@oneidentity/zstd-js");
|
|
38
|
-
class ZstdCodecManager {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.codec = null;
|
|
41
|
-
this.initPromise = null;
|
|
42
|
-
this.operationQueue = Promise.resolve();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Get the singleton instance of ZstdCodecManager
|
|
46
|
-
*/
|
|
47
|
-
static getInstance() {
|
|
48
|
-
if (!ZstdCodecManager.instance) {
|
|
49
|
-
ZstdCodecManager.instance = new ZstdCodecManager();
|
|
50
|
-
}
|
|
51
|
-
return ZstdCodecManager.instance;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Ensure the Zstd codec is initialized
|
|
55
|
-
* This is called automatically before any compress/decompress operation
|
|
56
|
-
*/
|
|
57
|
-
async ensureInitialized() {
|
|
58
|
-
if (this.codec) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (this.initPromise) {
|
|
62
|
-
return this.initPromise;
|
|
63
|
-
}
|
|
64
|
-
this.initPromise = (async () => {
|
|
65
|
-
this.codec = await (0, zstd_js_1.ZstdInit)();
|
|
66
|
-
})();
|
|
67
|
-
return this.initPromise;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Queue an operation to ensure sequential execution
|
|
71
|
-
* This prevents concurrent operations from interfering with each other
|
|
72
|
-
*/
|
|
73
|
-
async queueOperation(operation) {
|
|
74
|
-
// Chain this operation after the previous one
|
|
75
|
-
const promise = this.operationQueue.then(operation, operation);
|
|
76
|
-
// Update the queue to point to this operation
|
|
77
|
-
this.operationQueue = promise.catch(() => { }); // Catch to prevent unhandled rejections in queue
|
|
78
|
-
return promise;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Compress data using Zstd
|
|
82
|
-
* @param data - Data to compress (Uint8Array)
|
|
83
|
-
* @param level - Compression level (1-22, default 6)
|
|
84
|
-
* @returns Compressed data as Uint8Array
|
|
85
|
-
*/
|
|
86
|
-
async compress(data, level = 6) {
|
|
87
|
-
return this.queueOperation(async () => {
|
|
88
|
-
await this.ensureInitialized();
|
|
89
|
-
if (!this.codec) {
|
|
90
|
-
throw new Error('Zstd codec not initialized');
|
|
91
|
-
}
|
|
92
|
-
return this.codec.ZstdSimple.compress(data, level);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Decompress data using Zstd
|
|
97
|
-
* @param data - Compressed data (Uint8Array or Buffer)
|
|
98
|
-
* @returns Decompressed data as Uint8Array
|
|
99
|
-
*/
|
|
100
|
-
async decompress(data) {
|
|
101
|
-
return this.queueOperation(async () => {
|
|
102
|
-
await this.ensureInitialized();
|
|
103
|
-
if (!this.codec) {
|
|
104
|
-
throw new Error('Zstd codec not initialized');
|
|
105
|
-
}
|
|
106
|
-
// Convert Buffer to Uint8Array if needed
|
|
107
|
-
const inputData = data instanceof Buffer
|
|
108
|
-
? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)
|
|
109
|
-
: data;
|
|
110
|
-
return this.codec.ZstdSimple.decompress(inputData);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Reset the manager (for testing purposes)
|
|
115
|
-
* @internal
|
|
116
|
-
*/
|
|
117
|
-
static reset() {
|
|
118
|
-
ZstdCodecManager.instance = null;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
ZstdCodecManager.instance = null;
|
|
122
|
-
/**
|
|
123
|
-
* Global Zstd Manager
|
|
124
|
-
* Use this for all Zstd compression/decompression operations
|
|
125
|
-
*/
|
|
126
|
-
exports.ZstdManager = {
|
|
127
|
-
/**
|
|
128
|
-
* Compress data using Zstd
|
|
129
|
-
* Operations are automatically queued to prevent interference
|
|
130
|
-
*/
|
|
131
|
-
compress: (data, level) => ZstdCodecManager.getInstance().compress(data, level),
|
|
132
|
-
/**
|
|
133
|
-
* Decompress data using Zstd
|
|
134
|
-
* Operations are automatically queued to prevent interference
|
|
135
|
-
*/
|
|
136
|
-
decompress: (data) => ZstdCodecManager.getInstance().decompress(data),
|
|
137
|
-
/**
|
|
138
|
-
* Reset the manager (for testing)
|
|
139
|
-
* @internal
|
|
140
|
-
*/
|
|
141
|
-
reset: () => ZstdCodecManager.reset(),
|
|
142
|
-
};
|
|
143
|
-
exports.default = exports.ZstdManager;
|
|
144
|
-
//# sourceMappingURL=ZstdManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZstdManager.js","sourceRoot":"","sources":["../../src/core/ZstdManager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAEH,kDAA4D;AAE5D,MAAM,gBAAgB;IAMpB;QAJQ,UAAK,GAA6C,IAAI,CAAC;QACvD,gBAAW,GAAyB,IAAI,C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AAgB,CAAC,KAAK,EAAE;CACtC,CAAC;AAEF,kBAAe,mBAAW,CAAC"}
|
package/src/core/ZstdManager.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ZstdManager - Global Zstd Codec Manager
|
|
3
|
-
*
|
|
4
|
-
* This manager ensures safe usage of the Zstd WASM module across multiple instances.
|
|
5
|
-
*
|
|
6
|
-
* ## Why This Is Necessary
|
|
7
|
-
*
|
|
8
|
-
* The `@oneidentity/zstd-js` library uses a shared WASM module internally.
|
|
9
|
-
* While `ZstdInit()` returns different object references, they all share the same
|
|
10
|
-
* `ZstdSimple` implementation and WASM memory/heap.
|
|
11
|
-
*
|
|
12
|
-
* This means concurrent or improperly managed sequential operations can cause
|
|
13
|
-
* memory corruption because they're all operating on the same underlying WASM state.
|
|
14
|
-
*
|
|
15
|
-
* ## How It Works
|
|
16
|
-
*
|
|
17
|
-
* 1. Single initialization: WASM module is initialized once globally
|
|
18
|
-
* 2. Operation queuing: All compress/decompress operations are queued
|
|
19
|
-
* 3. Sequential execution: JavaScript's single-threaded nature ensures safe execution
|
|
20
|
-
* 4. Automatic initialization: Lazy initialization on first use
|
|
21
|
-
*
|
|
22
|
-
* ## Usage
|
|
23
|
-
*
|
|
24
|
-
* ```typescript
|
|
25
|
-
* import { ZstdManager } from './ZstdManager';
|
|
26
|
-
*
|
|
27
|
-
* // Compress
|
|
28
|
-
* const compressed = await ZstdManager.compress(data, level);
|
|
29
|
-
*
|
|
30
|
-
* // Decompress
|
|
31
|
-
* const decompressed = await ZstdManager.decompress(compressedData);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
import { ZstdInit, ZstdSimple } from '@oneidentity/zstd-js';
|
|
36
|
-
|
|
37
|
-
class ZstdCodecManager {
|
|
38
|
-
private static instance: ZstdCodecManager | null = null;
|
|
39
|
-
private codec: { ZstdSimple: typeof ZstdSimple } | null = null;
|
|
40
|
-
private initPromise: Promise<void> | null = null;
|
|
41
|
-
private operationQueue: Promise<any> = Promise.resolve();
|
|
42
|
-
|
|
43
|
-
private constructor() {}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Get the singleton instance of ZstdCodecManager
|
|
47
|
-
*/
|
|
48
|
-
public static getInstance(): ZstdCodecManager {
|
|
49
|
-
if (!ZstdCodecManager.instance) {
|
|
50
|
-
ZstdCodecManager.instance = new ZstdCodecManager();
|
|
51
|
-
}
|
|
52
|
-
return ZstdCodecManager.instance;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Ensure the Zstd codec is initialized
|
|
57
|
-
* This is called automatically before any compress/decompress operation
|
|
58
|
-
*/
|
|
59
|
-
private async ensureInitialized(): Promise<void> {
|
|
60
|
-
if (this.codec) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (this.initPromise) {
|
|
65
|
-
return this.initPromise;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this.initPromise = (async () => {
|
|
69
|
-
this.codec = await ZstdInit();
|
|
70
|
-
})();
|
|
71
|
-
|
|
72
|
-
return this.initPromise;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Queue an operation to ensure sequential execution
|
|
77
|
-
* This prevents concurrent operations from interfering with each other
|
|
78
|
-
*/
|
|
79
|
-
private async queueOperation<T>(operation: () => Promise<T> | T): Promise<T> {
|
|
80
|
-
// Chain this operation after the previous one
|
|
81
|
-
const promise = this.operationQueue.then(operation, operation);
|
|
82
|
-
|
|
83
|
-
// Update the queue to point to this operation
|
|
84
|
-
this.operationQueue = promise.catch(() => {}); // Catch to prevent unhandled rejections in queue
|
|
85
|
-
|
|
86
|
-
return promise;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Compress data using Zstd
|
|
91
|
-
* @param data - Data to compress (Uint8Array)
|
|
92
|
-
* @param level - Compression level (1-22, default 6)
|
|
93
|
-
* @returns Compressed data as Uint8Array
|
|
94
|
-
*/
|
|
95
|
-
public async compress(data: Uint8Array, level: number = 6): Promise<Uint8Array> {
|
|
96
|
-
return this.queueOperation(async () => {
|
|
97
|
-
await this.ensureInitialized();
|
|
98
|
-
|
|
99
|
-
if (!this.codec) {
|
|
100
|
-
throw new Error('Zstd codec not initialized');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return this.codec.ZstdSimple.compress(data, level);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Decompress data using Zstd
|
|
109
|
-
* @param data - Compressed data (Uint8Array or Buffer)
|
|
110
|
-
* @returns Decompressed data as Uint8Array
|
|
111
|
-
*/
|
|
112
|
-
public async decompress(data: Uint8Array | Buffer): Promise<Uint8Array> {
|
|
113
|
-
return this.queueOperation(async () => {
|
|
114
|
-
await this.ensureInitialized();
|
|
115
|
-
|
|
116
|
-
if (!this.codec) {
|
|
117
|
-
throw new Error('Zstd codec not initialized');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Convert Buffer to Uint8Array if needed
|
|
121
|
-
const inputData = data instanceof Buffer
|
|
122
|
-
? new Uint8Array(data.buffer, data.byteOffset, data.byteLength)
|
|
123
|
-
: data;
|
|
124
|
-
|
|
125
|
-
return this.codec.ZstdSimple.decompress(inputData);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Reset the manager (for testing purposes)
|
|
131
|
-
* @internal
|
|
132
|
-
*/
|
|
133
|
-
public static reset(): void {
|
|
134
|
-
ZstdCodecManager.instance = null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Global Zstd Manager
|
|
140
|
-
* Use this for all Zstd compression/decompression operations
|
|
141
|
-
*/
|
|
142
|
-
export const ZstdManager = {
|
|
143
|
-
/**
|
|
144
|
-
* Compress data using Zstd
|
|
145
|
-
* Operations are automatically queued to prevent interference
|
|
146
|
-
*/
|
|
147
|
-
compress: (data: Uint8Array, level?: number) =>
|
|
148
|
-
ZstdCodecManager.getInstance().compress(data, level),
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Decompress data using Zstd
|
|
152
|
-
* Operations are automatically queued to prevent interference
|
|
153
|
-
*/
|
|
154
|
-
decompress: (data: Uint8Array | Buffer) =>
|
|
155
|
-
ZstdCodecManager.getInstance().decompress(data),
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Reset the manager (for testing)
|
|
159
|
-
* @internal
|
|
160
|
-
*/
|
|
161
|
-
reset: () => ZstdCodecManager.reset(),
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export default ZstdManager;
|
|
165
|
-
|