neozipkit 0.8.0 → 1.0.5
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/NEOZIP_APPNOTE.md +527 -0
- package/README.md +57 -21
- package/WHATS_NEW.md +146 -0
- package/dist/browser/ZipkitBrowser.d.ts.map +1 -1
- package/dist/browser/ZipkitBrowser.js +4 -6
- package/dist/browser/ZipkitBrowser.js.map +1 -1
- 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 +2110 -41755
- package/dist/browser-esm/index.js.map +4 -4
- package/dist/browser-umd/index.js +2110 -41755
- 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 +57 -33
- 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 +27 -17
- package/dist/core/ZipDecompress.js.map +1 -1
- package/dist/core/ZipEntry.d.ts +6 -0
- package/dist/core/ZipEntry.d.ts.map +1 -1
- package/dist/core/ZipEntry.js +7 -1
- package/dist/core/ZipEntry.js.map +1 -1
- package/dist/core/Zipkit.d.ts +43 -11
- package/dist/core/Zipkit.d.ts.map +1 -1
- package/dist/core/Zipkit.js +106 -63
- package/dist/core/Zipkit.js.map +1 -1
- package/dist/core/components/HashCalculator.d.ts +22 -1
- package/dist/core/components/HashCalculator.d.ts.map +1 -1
- package/dist/core/components/HashCalculator.js +49 -6
- package/dist/core/components/HashCalculator.js.map +1 -1
- package/dist/core/components/Util.d.ts +3 -4
- package/dist/core/components/Util.d.ts.map +1 -1
- package/dist/core/components/Util.js +10 -8
- package/dist/core/components/Util.js.map +1 -1
- package/dist/core/constants/Headers.d.ts +1 -3
- package/dist/core/constants/Headers.d.ts.map +1 -1
- package/dist/core/constants/Headers.js +14 -5
- package/dist/core/constants/Headers.js.map +1 -1
- package/dist/core/constants/MetaPaths.d.ts +38 -0
- package/dist/core/constants/MetaPaths.d.ts.map +1 -0
- package/dist/core/constants/MetaPaths.js +79 -0
- package/dist/core/constants/MetaPaths.js.map +1 -0
- 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/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +14 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/merkle/MerkleRoot.d.ts +109 -0
- package/dist/core/merkle/MerkleRoot.d.ts.map +1 -0
- package/dist/core/merkle/MerkleRoot.js +275 -0
- package/dist/core/merkle/MerkleRoot.js.map +1 -0
- 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 +105 -75
- 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 +68 -56
- package/dist/node/ZipDecompressNode.js.map +1 -1
- package/dist/node/ZipkitNode.d.ts +23 -0
- package/dist/node/ZipkitNode.d.ts.map +1 -1
- package/dist/node/ZipkitNode.js +195 -41
- 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 +4 -3
- package/src/browser/ZipkitBrowser.ts +4 -6
- package/src/browser/zstd-browser-shim.ts +76 -0
- package/src/core/ZipCompress.ts +71 -42
- package/src/core/ZipDecompress.ts +35 -18
- package/src/core/ZipEntry.ts +8 -1
- package/src/core/Zipkit.ts +149 -76
- package/src/core/components/HashCalculator.ts +58 -6
- package/src/core/components/Util.ts +16 -7
- package/src/core/constants/Headers.ts +14 -4
- package/src/core/constants/MetaPaths.ts +86 -0
- package/src/core/encryption/AesCrypto.ts +265 -86
- package/src/core/encryption/index.ts +1 -1
- package/src/core/index.ts +14 -0
- package/src/core/merkle/MerkleRoot.ts +312 -0
- package/src/core/version.ts +1 -1
- package/src/node/LegacyZstd.ts +270 -0
- package/src/node/ZipCompressNode.ts +127 -84
- package/src/node/ZipDecompressNode.ts +93 -67
- package/src/node/ZipkitNode.ts +230 -42
- 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/README.md
CHANGED
|
@@ -4,24 +4,24 @@ Advanced ZIP file creation, compression, and encryption library for Node.js and
|
|
|
4
4
|
|
|
5
5
|
**Scope of this package:** NeoZipKit focuses solely on creating and manipulating ZIP files (compression, encryption, extraction). All blockchain-related functionality—timestamping, NFT tokenization, verification, wallet integration, and smart contracts—lives in the sibling **[neozip-blockchain](../neozip-blockchain/)** package within this monorepo. Use that package when you need to link ZIPs to the blockchain.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
> -
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
> We welcome feedback and contributions! Please report issues on [GitHub](https://github.com/NeoWareInc/neozipkit/issues). This package is part of the [neozipkit monorepo](../../README.md).
|
|
7
|
+
**Format note:** See **[NEOZIP_APPNOTE.md](./NEOZIP_APPNOTE.md)** for the NeoZip ZIP profile (compression methods, Extra Field `0x014E`, `META-INF` integrity and blockchain sidecars).
|
|
8
|
+
|
|
9
|
+
> **Stable 1.0:** NeoZipKit **1.0.5** (first non-beta was **1.0.2**). See [NEOZIP_APPNOTE.md](./NEOZIP_APPNOTE.md) and [WHATS_NEW.md](WHATS_NEW.md). Please report issues on [GitHub](https://github.com/NeoWareInc/neozipkit/issues).
|
|
10
|
+
|
|
11
|
+
|
|
14
12
|
|
|
15
13
|
## Features
|
|
16
14
|
|
|
17
15
|
- **Advanced ZIP compression** with support for multiple compression methods (Deflate, ZStandard, Stored)
|
|
18
16
|
- **Streaming compression** for memory-efficient processing of large files
|
|
19
|
-
- **Encryption** with ZIP (Legacy), **AES-256**
|
|
17
|
+
- **Encryption** with ZIP (Legacy), **NeoEncrypt** (default AES-256 via Extra Field `0x024E`), and **WinZip AES-256** (AE-1/AE-2, method 99 — write with `encryptionMethod: 'aes256'`, always readable on extract); create and extract in Node and browser
|
|
20
18
|
- **Hash-based verification** with Merkle tree support (CRC-32, SHA-256)
|
|
21
19
|
- **Real-time progress tracking** for long-running operations
|
|
22
20
|
- **Browser and Node.js compatibility** with clean platform separation
|
|
23
21
|
- **TypeScript support** with full type definitions
|
|
24
22
|
|
|
23
|
+
|
|
24
|
+
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
27
27
|
```bash
|
|
@@ -34,8 +34,12 @@ Or with npm:
|
|
|
34
34
|
npm install neozipkit
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
|
|
37
39
|
## Quick Start
|
|
38
40
|
|
|
41
|
+
|
|
42
|
+
|
|
39
43
|
### Node.js
|
|
40
44
|
|
|
41
45
|
```typescript
|
|
@@ -50,6 +54,8 @@ await zip.createZipFromFiles(['file1.txt', 'file2.txt'], 'output.zip');
|
|
|
50
54
|
await zip.extractZipFile('archive.zip', './output');
|
|
51
55
|
```
|
|
52
56
|
|
|
57
|
+
|
|
58
|
+
|
|
53
59
|
### Browser
|
|
54
60
|
|
|
55
61
|
```typescript
|
|
@@ -60,9 +66,11 @@ await zip.addFile(file, { level: 6 });
|
|
|
60
66
|
const zipBlob = await zip.createZipBlob();
|
|
61
67
|
```
|
|
62
68
|
|
|
69
|
+
|
|
70
|
+
|
|
63
71
|
### Examples
|
|
64
72
|
|
|
65
|
-
Runnable examples live **only in this repository**—they are **not** shipped in the [npm package](https://www.npmjs.com/package/neozipkit)
|
|
73
|
+
Runnable examples live **only in this repository**—they are **not** shipped in the [npm package](https://www.npmjs.com/package/neozipkit). Browse or clone the repo to use them.
|
|
66
74
|
|
|
67
75
|
On GitHub: [`packages/neozipkit/examples/`](https://github.com/NeoWareInc/neozipkit/tree/main/packages/neozipkit/examples) — see [`examples/README.md`](examples/README.md) for scripts (create/extract/list/copy ZIP, AES demos, encrypted listing) and how to run them from a checkout.
|
|
68
76
|
|
|
@@ -72,20 +80,39 @@ cd packages/neozipkit
|
|
|
72
80
|
npx ts-node examples/create-zip.ts
|
|
73
81
|
```
|
|
74
82
|
|
|
83
|
+
|
|
84
|
+
|
|
75
85
|
## Blockchain integration
|
|
76
86
|
|
|
77
87
|
All blockchain code lives in the sibling **[neozip-blockchain](../neozip-blockchain/)** package within this monorepo. For timestamping, NFT tokenization, on-chain verification, wallet management, and OpenTimestamps, install `neozip-blockchain` alongside this package. It depends on `neozipkit` for ZIP handling and adds all blockchain features on top. NeoZipKit itself contains no blockchain, contract, or wallet code.
|
|
78
88
|
|
|
79
89
|
## Package layout
|
|
80
90
|
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
91
|
+
- `neozipkit` – Main entry (core + platform detection)
|
|
92
|
+
- `neozipkit/node` – Node.js-only (ZipkitNode, file I/O, streaming)
|
|
93
|
+
- `neozipkit/browser` – Browser-only (ZipkitBrowser, Blob API)
|
|
94
|
+
- `neozipkit/browser-esm` – Browser ESM bundle (tree-shaking)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## I/O model (aligned with Rust NeoZipKit)
|
|
99
|
+
|
|
100
|
+
**Node / CLI product path:** one streaming (chunked) engine — read → hash → compress/encrypt → write in ~512 KiB buffers. There is no separate full-archive “VM / in-memory” mode. Small entries may still use an in-API buffer fast path inside the same APIs.
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
| Surface | Behavior |
|
|
104
|
+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `ZipkitNode` create / extract / list | File streaming (`loadZipFile`, `writeZipEntry`, `extractToFile`, …) |
|
|
106
|
+
| Core `Zipkit.loadZip(Buffer)` / browser | Buffer APIs kept for browser and small in-process buffers |
|
|
107
|
+
| Zstd (method 93) | Node native `zlib` Transform streams only (no WASM). Requires Node ≥ 22.15 |
|
|
108
|
+
| Legacy WASM zstd archives | Detect with `detectLegacyWasmZstd` / `ZipkitNode.detectLegacyZstdEntries`; extract truncates +18 zero padding |
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
See also: [docs/ZSTD_USAGE.md](docs/ZSTD_USAGE.md) and the Rust crate notes in `neozip-rust` (`crates/neozipkit/src/limits.rs`).
|
|
85
112
|
|
|
86
113
|
## Publishing (npm)
|
|
87
114
|
|
|
88
|
-
The published tarball includes **`dist/`**, **`src/`** (for `neozipkit/src` conditional exports),
|
|
115
|
+
The published tarball includes **`dist/`**, **`src/`** (for `neozipkit/src` conditional exports), **[`README.md`](README.md)**, and **[`WHATS_NEW.md`](WHATS_NEW.md)**. **`examples/`** and other repo-only folders are excluded—use **`pnpm publish:dry-run`** (`npm publish --dry-run`) to preview the file list.
|
|
89
116
|
|
|
90
117
|
## Development
|
|
91
118
|
|
|
@@ -110,13 +137,15 @@ pnpm build
|
|
|
110
137
|
pnpm test
|
|
111
138
|
```
|
|
112
139
|
|
|
113
|
-
See [
|
|
140
|
+
See `[docs/DEV_BUILD.md](docs/DEV_BUILD.md)` for the development build system and the [monorepo README](../../README.md) for version management and release workflow.
|
|
114
141
|
|
|
115
142
|
## API overview
|
|
116
143
|
|
|
144
|
+
|
|
145
|
+
|
|
117
146
|
### ZipkitNode and file handles (Node.js)
|
|
118
147
|
|
|
119
|
-
`ZipkitNode.loadZipFile()` opens the archive with `fs.promises.open()`. You should call
|
|
148
|
+
`ZipkitNode.loadZipFile()` opens the archive with `fs.promises.open()`. You should call `closeFile()` when you are done reading so the `FileHandle` is released promptly. Node deprecates relying on garbage collection to close handles ([DEP0137](https://nodejs.org/api/deprecations.html#DEP0137)).
|
|
120
149
|
|
|
121
150
|
As of **v0.6.1**, `loadZipFile()` automatically **closes any prior read handle** before loading another path on the **same** instance, so reusing a `ZipkitNode` does not leak descriptors. `closeFile()` remains the right way to finish with the current archive.
|
|
122
151
|
|
|
@@ -131,21 +160,28 @@ As of **v0.6.1**, `loadZipFile()` automatically **closes any prior read handle**
|
|
|
131
160
|
- **EncryptionManager** / **ZipCrypto** – Legacy ZIP encryption
|
|
132
161
|
- **AesCrypto** / **EncryptionMethod.AES_256** – AES-256 encryption (WinZip AE-1/AE-2)
|
|
133
162
|
|
|
163
|
+
|
|
164
|
+
|
|
134
165
|
### Compression methods
|
|
135
166
|
|
|
136
167
|
- **STORED (0)** – No compression
|
|
137
168
|
- **DEFLATED (8)** – Deflate (default)
|
|
138
169
|
- **ZSTD (93)** – Zstandard
|
|
139
170
|
|
|
171
|
+
|
|
172
|
+
|
|
140
173
|
### Encryption
|
|
141
174
|
|
|
142
|
-
- **
|
|
143
|
-
|
|
144
|
-
- **
|
|
175
|
+
- **NeoEncrypt (default AES-256)** – When you pass a `password` and omit `encryptionMethod` (or set `'neo-aes256'`), NeoZipKit writes NeoEncrypt: standard compression method in the header + Extra Field `0x024E`. Spec: [docs/NEO_CRYPTO_FORMAT.md](docs/NEO_CRYPTO_FORMAT.md).
|
|
176
|
+
**Note:** kit API name `'aes256'` still means **WinZip write**; product CLI `--aes256` / `-e` means **NeoEncrypt**.
|
|
177
|
+
- **WinZip AES-256 (interop)** – Use `password` and `encryptionMethod: 'aes256'` to **write** AE-1/AE-2 (method 99 + Extra Field `0x9901`). Extract always recognizes WinZip AES when present. Layout: [docs/WINZIP_AES_FORMAT.md](docs/WINZIP_AES_FORMAT.md).
|
|
178
|
+
- **ZIP (Legacy / ZipCrypto)** – Classic ZIP encryption; use `password` with `encryptionMethod: 'zipcrypto'`.
|
|
179
|
+
|
|
180
|
+
|
|
145
181
|
|
|
146
182
|
## What’s new
|
|
147
183
|
|
|
148
|
-
See [WHATS_NEW.md](WHATS_NEW.md) for release notes.
|
|
184
|
+
See [WHATS_NEW.md](WHATS_NEW.md) for release notes.
|
|
149
185
|
|
|
150
186
|
## Security
|
|
151
187
|
|
|
@@ -153,4 +189,4 @@ See [SECURITY.md](SECURITY.md) for security considerations and best practices.
|
|
|
153
189
|
|
|
154
190
|
## License
|
|
155
191
|
|
|
156
|
-
MIT
|
|
192
|
+
MIT
|
package/WHATS_NEW.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# What’s New in NeoZipKit
|
|
2
|
+
|
|
3
|
+
Release notes for people who install and use **`neozipkit`** from npm. For blockchain timestamping and NFTs, see the sibling package [`neozip-blockchain`](https://www.npmjs.com/package/neozip-blockchain).
|
|
4
|
+
|
|
5
|
+
## 1.0.5 (2026-08-14)
|
|
6
|
+
|
|
7
|
+
### NeoZip Application Note + APPNOTE §6 Merkle (v0 / v1)
|
|
8
|
+
|
|
9
|
+
Ships **[NEOZIP_APPNOTE.md](./NEOZIP_APPNOTE.md)** in the npm package (also linked from the README). Aligns the kit with the profile’s **wire foundations** and **§6 Merkle** algorithms (optional AI-aware `META-INF/manifest.json` is still forthcoming).
|
|
10
|
+
|
|
11
|
+
**Foundations:**
|
|
12
|
+
|
|
13
|
+
- Extra Field **`0x014E`** — per-entry SHA-256 of uncompressed payload (when `useSHA256: true`)
|
|
14
|
+
- Zstd method **93** when you opt in with `useZstd: true` (Node ≥ 22.15; Deflate remains the library default)
|
|
15
|
+
- **ASCII case-insensitive** discovery of reserved `META-INF/` paths (`TOKEN.NZIP`, `TIMESTAMP.NZIP`, `TS-SUBMIT.NZIP`, OTS twins, `manifest.json`)
|
|
16
|
+
- Merkle leaves exclude all **`META-INF/**`** entries
|
|
17
|
+
|
|
18
|
+
**Merkle root (APPNOTE §6):**
|
|
19
|
+
|
|
20
|
+
| Algorithm | Leaves | Odd node | Domain separation |
|
|
21
|
+
| :---- | :---- | :---- | :---- |
|
|
22
|
+
| **v1** (default, new archives) | `SHA-256(0x00 ‖ payload)` | Promote unhashed | `0x00` leaf / `0x01` parent |
|
|
23
|
+
| **v0** (legacy verify) | bare `0x014E` digests | Duplicate last (Bitcoin-style) | None |
|
|
24
|
+
|
|
25
|
+
**API:**
|
|
26
|
+
|
|
27
|
+
- **`getMerkleRootAsync()`** — preferred for **v1**: uses stream-captured `merkleLeafV1` when available, otherwise extracts content (buffer mode) or Node streaming `testEntry` (`ZipkitNode`)
|
|
28
|
+
- **`getMerkleRoot({ algorithm: 'v0' })`** — digests-only legacy root for old on-chain bindings
|
|
29
|
+
- **`getMerkleRoot()`** — v1 when leaves were already captured during create/hash; otherwise `null` (use async)
|
|
30
|
+
- Pure helpers / **`Zipkit.merkleRootFromEntries(...)`**: path normalize (NFC, `/`), path-ordered leaves, optional `merkleLeafV1`, `matchMerkleRoot` (§6.4-style v1→v0 fallback)
|
|
31
|
+
|
|
32
|
+
Leaves no longer sort by hash value or reorder parent pairs. During create/extract with `useSHA256`, **`HashCalculator`** computes bare digests and domain-separated **v1** leaves in the same streaming pass (`finalizeMerkleLeafV1` / entry `merkleLeafV1`).
|
|
33
|
+
|
|
34
|
+
**Also:** NeoEncrypt (`0x024E` + real compression method) remains the default confidential write path; WinZip AES (method **99** + **`0x9901`**) is recognized for interop (APPNOTE §4.2). TypeScript 6: removed deprecated `baseUrl` from the package tsconfig.
|
|
35
|
+
|
|
36
|
+
Helpers: `findReservedMetaEntry`, `isMetaInfPath`, `isReservedMetaPath`, `asciiPathEqualsIgnoreCase`.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 1.0.2 (2026-07-28)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### First stable release
|
|
44
|
+
|
|
45
|
+
**1.0.2** is the first non-beta release. From here on, NeoZipKit follows [Semantic Versioning](https://semver.org/): breaking API changes bump the major version.
|
|
46
|
+
|
|
47
|
+
*(Versions `1.0.0` / `1.0.1` were reserved earlier on npm and are not used for this stable line.)*
|
|
48
|
+
|
|
49
|
+
### Zstandard compression (Node.js)
|
|
50
|
+
|
|
51
|
+
Zstd (ZIP method **93**) now uses **Node.js built-in `zlib` streaming**. The previous WASM-based codec is removed.
|
|
52
|
+
|
|
53
|
+
**What this means for you:**
|
|
54
|
+
|
|
55
|
+
- Use Zstd only on **Node.js ≥ 22.15** or **≥ 23.8**.
|
|
56
|
+
- Archives are compatible with other tools that support ZIP method 93 / libzstd.
|
|
57
|
+
- Large files stay memory-efficient (chunked streaming, default buffer ~512 KiB).
|
|
58
|
+
- **Browsers do not support Zstd.** Use Deflate (or Stored) in the browser, or create/extract Zstd archives in Node.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { ZipkitNode } from 'neozipkit/node';
|
|
62
|
+
|
|
63
|
+
const zip = new ZipkitNode();
|
|
64
|
+
await zip.createZipFromFiles(['file1.txt', 'file2.txt'], 'output.zip', {
|
|
65
|
+
useZstd: true,
|
|
66
|
+
level: 6,
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Upgrading from older NeoZipKit Zstd archives:** Older releases wrote frames with a small padding quirk. Extract still works; you can also scan an archive:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const hits = await zip.detectLegacyZstdEntries('old-archive.zip');
|
|
74
|
+
for (const { entry, detection } of hits) {
|
|
75
|
+
if (detection.isLegacyWasm) {
|
|
76
|
+
console.log(entry.filename, detection.confidence, detection.reason);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Streaming-first I/O (Node)
|
|
82
|
+
|
|
83
|
+
Node create/extract/list paths are **streaming** (read → hash → compress/encrypt → write in chunks). There is no separate “load the whole archive into a VM” mode.
|
|
84
|
+
|
|
85
|
+
- Prefer `ZipkitNode` file APIs for disk workflows.
|
|
86
|
+
- Buffer APIs remain for the browser and small in-process use cases.
|
|
87
|
+
|
|
88
|
+
### Compatibility snapshot
|
|
89
|
+
|
|
90
|
+
| Environment | Deflate / Stored | Zstd | AES-256 / NeoEncrypt / ZipCrypto |
|
|
91
|
+
|-------------|------------------|------|-----------------------------------|
|
|
92
|
+
| Node.js (see version above for Zstd) | Yes | Yes | Yes |
|
|
93
|
+
| Browser (ESM / UMD) | Yes | No | Yes |
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 0.6.1 (2026-03-30)
|
|
98
|
+
|
|
99
|
+
### More reliable file handle reuse (Node.js)
|
|
100
|
+
|
|
101
|
+
If you call `loadZipFile()` more than once on the same `ZipkitNode` instance, NeoZipKit now **closes the previous read handle** before opening the next file. Failed loads also clean up so handles are not left open. `closeFile()` clears path/size metadata so “closed” means no archive is loaded.
|
|
102
|
+
|
|
103
|
+
This avoids descriptor leaks and Node’s `FileHandle` GC deprecation warning when reusing a `ZipkitNode`.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 0.6.0 (2025-01-27)
|
|
108
|
+
|
|
109
|
+
### AES-256 encryption
|
|
110
|
+
|
|
111
|
+
Full **WinZip-compatible AES-256 (AE-1/AE-2)** support, in addition to legacy ZIP encryption.
|
|
112
|
+
|
|
113
|
+
- Create and extract encrypted ZIPs in **Node and the browser**.
|
|
114
|
+
- Interop with WinZip, 7-Zip, The Unarchiver (`unar`/`lsar`), and other AE-1/AE-2 tools.
|
|
115
|
+
|
|
116
|
+
**Create (NeoEncrypt — default when only `password` is set):**
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const zip = new ZipkitNode();
|
|
120
|
+
await zip.createZipFromFiles(
|
|
121
|
+
['file1.txt', 'file2.txt'],
|
|
122
|
+
'secure.zip',
|
|
123
|
+
{
|
|
124
|
+
password: 'YourStrongPassword',
|
|
125
|
+
// encryptionMethod: 'neo-aes256', // default when password is set
|
|
126
|
+
level: 6,
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Create (explicit WinZip AES write):** pass `encryptionMethod: 'aes256'` (method 99 + `0x9901`).
|
|
132
|
+
|
|
133
|
+
**Extract:** pass the same password; NeoZipKit auto-detects NeoEncrypt (`0x024E`), WinZip AES (method 99), or ZipCrypto.
|
|
134
|
+
|
|
135
|
+
**How it works (summary):** PBKDF2-HMAC-SHA1 (1000 iterations), AES-256-CTR (WinZip little-endian counter), HMAC-SHA1 over ciphertext (10-byte auth code per entry). NeoEncrypt and WinZip AES-256 share that ciphertext layout; headers differ (`0x024E` + real cmp method vs method 99 + `0x9901`).
|
|
136
|
+
|
|
137
|
+
Also in this release:
|
|
138
|
+
|
|
139
|
+
- Encryption bit set correctly on all encrypted local headers (including the last entry).
|
|
140
|
+
- Copy/append helpers for building archives by copying entries then finalizing the central directory.
|
|
141
|
+
|
|
142
|
+
**Naming note:** kit API `'aes256'` = WinZip **write**; product CLI `--aes256` / `-e` = **NeoEncrypt**. See [NEOZIP_APPNOTE.md](NEOZIP_APPNOTE.md) §4.2.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
For password handling and security notes, see the [SECURITY.md](https://github.com/NeoWareInc/neozipkit/blob/main/packages/neozipkit/SECURITY.md) in the repository.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipkitBrowser.d.ts","sourceRoot":"","sources":["../../src/browser/ZipkitBrowser.ts"],"names":[],"mappings":"AAKA,OAAO,MAAM,EAAE,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AAExC,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,MAAM,EAAS,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAY,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAMxD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,MAAM;;IAezC,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;IAyCzD,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ;IAetC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAqCzF,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAgB3E,aAAa,CAAC,UAAU,CAAC,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,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AC,IAAI,GAAG,IAAI,CAAC;IAwGnG;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAQhB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkBrE,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAS9E"}
|
|
@@ -51,7 +51,7 @@ const Errors_1 = __importDefault(require("../core/constants/Errors"));
|
|
|
51
51
|
exports.Errors = Errors_1.default;
|
|
52
52
|
const Headers = __importStar(require("../core/constants/Headers"));
|
|
53
53
|
exports.Headers = Headers;
|
|
54
|
-
const
|
|
54
|
+
const MetaPaths_1 = require("../core/constants/MetaPaths");
|
|
55
55
|
const ZipCrypto_1 = require("../core/encryption/ZipCrypto");
|
|
56
56
|
Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return ZipCrypto_1.sha256; } });
|
|
57
57
|
const Util_1 = require("../core/components/Util");
|
|
@@ -187,7 +187,7 @@ class ZipkitBrowser extends core_1.default {
|
|
|
187
187
|
for (const entry of zipEntries) {
|
|
188
188
|
if (!entry.isUpdated) {
|
|
189
189
|
// Check for META-INF metadata files even in copy mode
|
|
190
|
-
if (
|
|
190
|
+
if ((0, MetaPaths_1.isMetaInfPath)(entry.filename || '')) {
|
|
191
191
|
// Force this entry to be processed with special handling instead of copied
|
|
192
192
|
entry.isUpdated = true;
|
|
193
193
|
// Don't continue here - let it fall through to special handling below
|
|
@@ -218,7 +218,7 @@ class ZipkitBrowser extends core_1.default {
|
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
// Special handling for META-INF metadata files - store uncompressed with CRC-32
|
|
221
|
-
if (
|
|
221
|
+
if ((0, MetaPaths_1.isMetaInfPath)(entry.filename || '')) {
|
|
222
222
|
// For metadata files, use STORED compression (no compression)
|
|
223
223
|
const buffer = Buffer.from(fileBuffer);
|
|
224
224
|
// Calculate CRC-32 for the metadata file (not SHA-256 to avoid Merkle Root interference)
|
|
@@ -267,9 +267,7 @@ class ZipkitBrowser extends core_1.default {
|
|
|
267
267
|
* @returns boolean - True if the file is a metadata file
|
|
268
268
|
*/
|
|
269
269
|
isMetadataFile(filename) {
|
|
270
|
-
return
|
|
271
|
-
filename === Headers_1.TIMESTAMP_METADATA ||
|
|
272
|
-
filename === Headers_1.TOKENIZED_METADATA;
|
|
270
|
+
return (0, MetaPaths_1.isMetaInfPath)(filename);
|
|
273
271
|
}
|
|
274
272
|
// --------------------------------------
|
|
275
273
|
// Helper method: Add a file to the ZIP with compression
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZipkitBrowser.js","sourceRoot":"","sources":["../../src/browser/ZipkitBrowser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,mBAAmB;AACnB,yDAAyD;AACzD,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,mDAAoE;AACpE,gEAAwC;AAY/B,mBAZF,kBAAQ,CAYE;AAVjB,sEAA8C;AAU3B,iBAVZ,gBAAM,CAUY;AATzB,mEAAqD;AAS1B,0BAAO;AARlC,
|
|
1
|
+
{"version":3,"file":"ZipkitBrowser.js","sourceRoot":"","sources":["../../src/browser/ZipkitBrowser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,mBAAmB;AACnB,yDAAyD;AACzD,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzC,mDAAoE;AACpE,gEAAwC;AAY/B,mBAZF,kBAAQ,CAYE;AAVjB,sEAA8C;AAU3B,iBAVZ,gBAAM,CAUY;AATzB,mEAAqD;AAS1B,0BAAO;AARlC,2DAA4D;AAC5D,4DAA6D;AAOzB,uFAP3B,kBAAM,OAO2B;AAN1C,kDAA8D;AAMlB,0FANzB,gBAAS,OAMyB;AAFrD,mCAAmC;AACnC,0CAAwB;AAGxB,yCAA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AI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,2BAA2B,KAAK,CAAC,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;YACnE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAtRD,gCAsRC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser stub for ZSTD — native zlib streaming is Node-only.
|
|
3
|
+
* Browser builds alias `ZstdNode` to this module so the bad WASM codec is never shipped.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isNativeZstdAvailable(): boolean;
|
|
6
|
+
export declare function mapCompressionLevel(_level: number): number;
|
|
7
|
+
export declare function createCompressTransform(_level?: number): never;
|
|
8
|
+
export declare function createDecompressTransform(): never;
|
|
9
|
+
export declare function compress(_data: Buffer, _level?: number): Promise<Buffer>;
|
|
10
|
+
export declare function decompress(_data: Buffer): Promise<Buffer>;
|
|
11
|
+
export declare function compressSync(_data: Buffer, _level?: number): Buffer;
|
|
12
|
+
export declare function decompressSync(_data: Buffer): Buffer;
|
|
13
|
+
export declare function compressChunks(_readChunk: (position: number, size: number) => Buffer, _totalSize: number, _chunkSize: number, _level: number, _onPlainChunk?: (chunk: Buffer) => void, _onCompressedChunk?: (chunk: Buffer) => void | Promise<void>): Promise<number>;
|
|
14
|
+
export declare function decompressStream(_compressedStream: AsyncIterable<Buffer>): AsyncGenerator<Buffer>;
|
|
15
|
+
export declare const ZstdNode: {
|
|
16
|
+
isNativeZstdAvailable: typeof isNativeZstdAvailable;
|
|
17
|
+
mapCompressionLevel: typeof mapCompressionLevel;
|
|
18
|
+
createCompressTransform: typeof createCompressTransform;
|
|
19
|
+
createDecompressTransform: typeof createDecompressTransform;
|
|
20
|
+
compress: typeof compress;
|
|
21
|
+
decompress: typeof decompress;
|
|
22
|
+
compressSync: typeof compressSync;
|
|
23
|
+
decompressSync: typeof decompressSync;
|
|
24
|
+
compressChunks: typeof compressChunks;
|
|
25
|
+
decompressStream: typeof decompressStream;
|
|
26
|
+
};
|
|
27
|
+
export default ZstdNode;
|
|
28
|
+
//# sourceMappingURL=zstd-browser-shim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zstd-browser-shim.d.ts","sourceRoot":"","sources":["../../src/browser/zstd-browser-shim.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAE9D;AAED,wBAAgB,yBAAyB,IAAI,KAAK,CAEjD;AAED,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE9E;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,EACtD,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EACvC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAC3D,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAuB,gBAAgB,CACrC,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,GACvC,cAAc,CAAC,MAAM,CAAC,CAExB;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;CAWpB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Browser stub for ZSTD — native zlib streaming is Node-only.
|
|
4
|
+
* Browser builds alias `ZstdNode` to this module so the bad WASM codec is never shipped.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ZstdNode = void 0;
|
|
8
|
+
exports.isNativeZstdAvailable = isNativeZstdAvailable;
|
|
9
|
+
exports.mapCompressionLevel = mapCompressionLevel;
|
|
10
|
+
exports.createCompressTransform = createCompressTransform;
|
|
11
|
+
exports.createDecompressTransform = createDecompressTransform;
|
|
12
|
+
exports.compress = compress;
|
|
13
|
+
exports.decompress = decompress;
|
|
14
|
+
exports.compressSync = compressSync;
|
|
15
|
+
exports.decompressSync = decompressSync;
|
|
16
|
+
exports.compressChunks = compressChunks;
|
|
17
|
+
exports.decompressStream = decompressStream;
|
|
18
|
+
const ZSTD_BROWSER_UNSUPPORTED = 'ZSTD requires Node.js with native zlib support (Node.js >= 22.15 or >= 23.8). ' +
|
|
19
|
+
'Browser builds do not include a zstd codec; use Deflate or process zstd archives in Node.';
|
|
20
|
+
function unsupported() {
|
|
21
|
+
throw new Error(ZSTD_BROWSER_UNSUPPORTED);
|
|
22
|
+
}
|
|
23
|
+
function isNativeZstdAvailable() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
function mapCompressionLevel(_level) {
|
|
27
|
+
return unsupported();
|
|
28
|
+
}
|
|
29
|
+
function createCompressTransform(_level) {
|
|
30
|
+
return unsupported();
|
|
31
|
+
}
|
|
32
|
+
function createDecompressTransform() {
|
|
33
|
+
return unsupported();
|
|
34
|
+
}
|
|
35
|
+
async function compress(_data, _level) {
|
|
36
|
+
return unsupported();
|
|
37
|
+
}
|
|
38
|
+
async function decompress(_data) {
|
|
39
|
+
return unsupported();
|
|
40
|
+
}
|
|
41
|
+
function compressSync(_data, _level) {
|
|
42
|
+
return unsupported();
|
|
43
|
+
}
|
|
44
|
+
function decompressSync(_data) {
|
|
45
|
+
return unsupported();
|
|
46
|
+
}
|
|
47
|
+
async function compressChunks(_readChunk, _totalSize, _chunkSize, _level, _onPlainChunk, _onCompressedChunk) {
|
|
48
|
+
return unsupported();
|
|
49
|
+
}
|
|
50
|
+
async function* decompressStream(_compressedStream) {
|
|
51
|
+
unsupported();
|
|
52
|
+
}
|
|
53
|
+
exports.ZstdNode = {
|
|
54
|
+
isNativeZstdAvailable,
|
|
55
|
+
mapCompressionLevel,
|
|
56
|
+
createCompressTransform,
|
|
57
|
+
createDecompressTransform,
|
|
58
|
+
compress,
|
|
59
|
+
decompress,
|
|
60
|
+
compressSync,
|
|
61
|
+
decompressSync,
|
|
62
|
+
compressChunks,
|
|
63
|
+
decompressStream,
|
|
64
|
+
};
|
|
65
|
+
exports.default = exports.ZstdNode;
|
|
66
|
+
//# sourceMappingURL=zstd-browser-shim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zstd-browser-shim.js","sourceRoot":"","sources":["../../src/browser/zstd-browser-shim.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAUH,sDAEC;AAED,kDAEC;AAED,0DAEC;AAED,8DAEC;AAED,4BAEC;AAED,gCAEC;AAED,oCAEC;AAED,wCAEC;AAED,wCASC;AAED,4CAIC;AAvDD,MAAM,wBAAwB,GAC5B,gFAAgF;IAChF,2FAA2F,CAAC;AAE9F,SAAS,WAAW;IAClB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,qBAAqB;IACnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAc;IAChD,OAAO,WAAW,EAAE,CAAC;A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