@neoware_inc/neozipkit 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +134 -0
  2. package/dist/browser/ZipkitBrowser.d.ts +27 -0
  3. package/dist/browser/ZipkitBrowser.d.ts.map +1 -0
  4. package/dist/browser/ZipkitBrowser.js +303 -0
  5. package/dist/browser/ZipkitBrowser.js.map +1 -0
  6. package/dist/browser/index.d.ts +9 -0
  7. package/dist/browser/index.d.ts.map +1 -0
  8. package/dist/browser/index.esm.d.ts +12 -0
  9. package/dist/browser/index.esm.d.ts.map +1 -0
  10. package/dist/browser/index.esm.js +46 -0
  11. package/dist/browser/index.esm.js.map +1 -0
  12. package/dist/browser/index.js +38 -0
  13. package/dist/browser/index.js.map +1 -0
  14. package/dist/browser-esm/index.d.ts +9 -0
  15. package/dist/browser-esm/index.js +50211 -0
  16. package/dist/browser-esm/index.js.map +7 -0
  17. package/dist/browser-umd/index.d.ts +9 -0
  18. package/dist/browser-umd/index.js +50221 -0
  19. package/dist/browser-umd/index.js.map +7 -0
  20. package/dist/browser-umd/index.min.js +39 -0
  21. package/dist/browser.d.ts +9 -0
  22. package/dist/browser.js +38 -0
  23. package/dist/core/ZipCompress.d.ts +99 -0
  24. package/dist/core/ZipCompress.d.ts.map +1 -0
  25. package/dist/core/ZipCompress.js +287 -0
  26. package/dist/core/ZipCompress.js.map +1 -0
  27. package/dist/core/ZipCopy.d.ts +175 -0
  28. package/dist/core/ZipCopy.d.ts.map +1 -0
  29. package/dist/core/ZipCopy.js +310 -0
  30. package/dist/core/ZipCopy.js.map +1 -0
  31. package/dist/core/ZipDecompress.d.ts +57 -0
  32. package/dist/core/ZipDecompress.d.ts.map +1 -0
  33. package/dist/core/ZipDecompress.js +155 -0
  34. package/dist/core/ZipDecompress.js.map +1 -0
  35. package/dist/core/ZipEntry.d.ts +138 -0
  36. package/dist/core/ZipEntry.d.ts.map +1 -0
  37. package/dist/core/ZipEntry.js +829 -0
  38. package/dist/core/ZipEntry.js.map +1 -0
  39. package/dist/core/Zipkit.d.ts +315 -0
  40. package/dist/core/Zipkit.d.ts.map +1 -0
  41. package/dist/core/Zipkit.js +647 -0
  42. package/dist/core/Zipkit.js.map +1 -0
  43. package/dist/core/ZstdManager.d.ts +56 -0
  44. package/dist/core/ZstdManager.d.ts.map +1 -0
  45. package/dist/core/ZstdManager.js +144 -0
  46. package/dist/core/ZstdManager.js.map +1 -0
  47. package/dist/core/components/HashCalculator.d.ts +138 -0
  48. package/dist/core/components/HashCalculator.d.ts.map +1 -0
  49. package/dist/core/components/HashCalculator.js +360 -0
  50. package/dist/core/components/HashCalculator.js.map +1 -0
  51. package/dist/core/components/Logger.d.ts +73 -0
  52. package/dist/core/components/Logger.d.ts.map +1 -0
  53. package/dist/core/components/Logger.js +156 -0
  54. package/dist/core/components/Logger.js.map +1 -0
  55. package/dist/core/components/ProgressTracker.d.ts +43 -0
  56. package/dist/core/components/ProgressTracker.d.ts.map +1 -0
  57. package/dist/core/components/ProgressTracker.js +112 -0
  58. package/dist/core/components/ProgressTracker.js.map +1 -0
  59. package/dist/core/components/Support.d.ts +64 -0
  60. package/dist/core/components/Support.d.ts.map +1 -0
  61. package/dist/core/components/Support.js +71 -0
  62. package/dist/core/components/Support.js.map +1 -0
  63. package/dist/core/components/Util.d.ts +26 -0
  64. package/dist/core/components/Util.d.ts.map +1 -0
  65. package/dist/core/components/Util.js +95 -0
  66. package/dist/core/components/Util.js.map +1 -0
  67. package/dist/core/constants/Errors.d.ts +52 -0
  68. package/dist/core/constants/Errors.d.ts.map +1 -0
  69. package/dist/core/constants/Errors.js +67 -0
  70. package/dist/core/constants/Errors.js.map +1 -0
  71. package/dist/core/constants/Headers.d.ts +170 -0
  72. package/dist/core/constants/Headers.d.ts.map +1 -0
  73. package/dist/core/constants/Headers.js +194 -0
  74. package/dist/core/constants/Headers.js.map +1 -0
  75. package/dist/core/encryption/Manager.d.ts +58 -0
  76. package/dist/core/encryption/Manager.d.ts.map +1 -0
  77. package/dist/core/encryption/Manager.js +121 -0
  78. package/dist/core/encryption/Manager.js.map +1 -0
  79. package/dist/core/encryption/ZipCrypto.d.ts +172 -0
  80. package/dist/core/encryption/ZipCrypto.d.ts.map +1 -0
  81. package/dist/core/encryption/ZipCrypto.js +554 -0
  82. package/dist/core/encryption/ZipCrypto.js.map +1 -0
  83. package/dist/core/encryption/index.d.ts +9 -0
  84. package/dist/core/encryption/index.d.ts.map +1 -0
  85. package/dist/core/encryption/index.js +17 -0
  86. package/dist/core/encryption/index.js.map +1 -0
  87. package/dist/core/encryption/types.d.ts +29 -0
  88. package/dist/core/encryption/types.d.ts.map +1 -0
  89. package/dist/core/encryption/types.js +12 -0
  90. package/dist/core/encryption/types.js.map +1 -0
  91. package/dist/core/index.d.ts +27 -0
  92. package/dist/core/index.d.ts.map +1 -0
  93. package/dist/core/index.js +59 -0
  94. package/dist/core/index.js.map +1 -0
  95. package/dist/core/version.d.ts +5 -0
  96. package/dist/core/version.d.ts.map +1 -0
  97. package/dist/core/version.js +31 -0
  98. package/dist/core/version.js.map +1 -0
  99. package/dist/index.d.ts +9 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +38 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/node/ZipCompressNode.d.ts +123 -0
  104. package/dist/node/ZipCompressNode.d.ts.map +1 -0
  105. package/dist/node/ZipCompressNode.js +565 -0
  106. package/dist/node/ZipCompressNode.js.map +1 -0
  107. package/dist/node/ZipCopyNode.d.ts +165 -0
  108. package/dist/node/ZipCopyNode.d.ts.map +1 -0
  109. package/dist/node/ZipCopyNode.js +347 -0
  110. package/dist/node/ZipCopyNode.js.map +1 -0
  111. package/dist/node/ZipDecompressNode.d.ts +197 -0
  112. package/dist/node/ZipDecompressNode.d.ts.map +1 -0
  113. package/dist/node/ZipDecompressNode.js +678 -0
  114. package/dist/node/ZipDecompressNode.js.map +1 -0
  115. package/dist/node/ZipkitNode.d.ts +466 -0
  116. package/dist/node/ZipkitNode.d.ts.map +1 -0
  117. package/dist/node/ZipkitNode.js +1426 -0
  118. package/dist/node/ZipkitNode.js.map +1 -0
  119. package/dist/node/index.d.ts +25 -0
  120. package/dist/node/index.d.ts.map +1 -0
  121. package/dist/node/index.js +54 -0
  122. package/dist/node/index.js.map +1 -0
  123. package/dist/types/index.d.ts +45 -0
  124. package/dist/types/index.d.ts.map +1 -0
  125. package/dist/types/index.js +11 -0
  126. package/dist/types/index.js.map +1 -0
  127. package/examples/README.md +261 -0
  128. package/examples/append-data.json +44 -0
  129. package/examples/copy-zip-append.ts +139 -0
  130. package/examples/copy-zip.ts +152 -0
  131. package/examples/create-zip.ts +172 -0
  132. package/examples/extract-zip.ts +118 -0
  133. package/examples/list-zip.ts +161 -0
  134. package/examples/test-files/data.json +116 -0
  135. package/examples/test-files/document.md +80 -0
  136. package/examples/test-files/document.txt +6 -0
  137. package/examples/test-files/file1.txt +48 -0
  138. package/examples/test-files/file2.txt +80 -0
  139. package/examples/tsconfig.json +44 -0
  140. package/package.json +167 -0
  141. package/src/browser/ZipkitBrowser.ts +305 -0
  142. package/src/browser/index.esm.ts +32 -0
  143. package/src/browser/index.ts +19 -0
  144. package/src/core/ZipCompress.ts +370 -0
  145. package/src/core/ZipCopy.ts +434 -0
  146. package/src/core/ZipDecompress.ts +191 -0
  147. package/src/core/ZipEntry.ts +917 -0
  148. package/src/core/Zipkit.ts +794 -0
  149. package/src/core/ZstdManager.ts +165 -0
  150. package/src/core/components/HashCalculator.ts +384 -0
  151. package/src/core/components/Logger.ts +180 -0
  152. package/src/core/components/ProgressTracker.ts +134 -0
  153. package/src/core/components/Support.ts +77 -0
  154. package/src/core/components/Util.ts +91 -0
  155. package/src/core/constants/Errors.ts +78 -0
  156. package/src/core/constants/Headers.ts +205 -0
  157. package/src/core/encryption/Manager.ts +137 -0
  158. package/src/core/encryption/ZipCrypto.ts +650 -0
  159. package/src/core/encryption/index.ts +15 -0
  160. package/src/core/encryption/types.ts +33 -0
  161. package/src/core/index.ts +42 -0
  162. package/src/core/version.ts +33 -0
  163. package/src/index.ts +19 -0
  164. package/src/node/ZipCompressNode.ts +618 -0
  165. package/src/node/ZipCopyNode.ts +437 -0
  166. package/src/node/ZipDecompressNode.ts +793 -0
  167. package/src/node/ZipkitNode.ts +1706 -0
  168. package/src/node/index.ts +40 -0
  169. package/src/types/index.ts +68 -0
  170. package/src/types/modules.d.ts +22 -0
  171. package/src/types/opentimestamps.d.ts +1 -0
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # neozipkit
2
+
3
+ Advanced ZIP file creation, compression, and encryption library for Node.js and the browser.
4
+
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—has been moved to **[neozip-blockchain](https://github.com/NeoWareInc/neozip-blockchain)**. Use that package when you need to link ZIPs to the blockchain.
6
+
7
+ > **⚠️ Alpha Version Warning**: NeoZipKit is currently in **alpha** status. This means:
8
+ > - The API may change in future releases
9
+ > - Some features may be incomplete or experimental
10
+ > - Breaking changes may occur before the stable release
11
+ > - Use in production with caution and thorough testing
12
+ >
13
+ > We welcome feedback and contributions! Please report issues on [GitHub](https://github.com/NeoWareInc/neozipkit/issues).
14
+
15
+ ## Features
16
+
17
+ - **Advanced ZIP compression** with support for multiple compression methods (Deflate, ZStandard, Stored)
18
+ - **Streaming compression** for memory-efficient processing of large files
19
+ - **Encryption** with ZIP crypto and AES support
20
+ - **Hash-based verification** with Merkle tree support (CRC-32, SHA-256)
21
+ - **Real-time progress tracking** for long-running operations
22
+ - **Browser and Node.js compatibility** with clean platform separation
23
+ - **TypeScript support** with full type definitions
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ yarn add @neoware_inc/neozipkit
29
+ ```
30
+
31
+ Or with npm:
32
+
33
+ ```bash
34
+ npm install @neoware_inc/neozipkit
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ### Node.js
40
+
41
+ ```typescript
42
+ import { ZipkitNode } from '@neoware_inc/neozipkit/node';
43
+
44
+ const zip = new ZipkitNode();
45
+
46
+ // Create a ZIP from files
47
+ await zip.createZipFromFiles(['file1.txt', 'file2.txt'], 'output.zip');
48
+
49
+ // Extract a ZIP file
50
+ await zip.extractZipFile('archive.zip', './output');
51
+ ```
52
+
53
+ ### Browser
54
+
55
+ ```typescript
56
+ import { ZipkitBrowser } from '@neoware_inc/neozipkit/browser-esm';
57
+
58
+ const zip = new ZipkitBrowser();
59
+ await zip.addFile(file, { level: 6 });
60
+ const zipBlob = await zip.createZipBlob();
61
+ ```
62
+
63
+ ### Examples
64
+
65
+ Runnable examples are in the `examples/` directory:
66
+
67
+ - **`examples/create-zip.ts`** – Create ZIP archives from multiple files
68
+ - **`examples/extract-zip.ts`** – Extract ZIP files to directories
69
+ - **`examples/list-zip.ts`** – List ZIP archive contents
70
+ - **`examples/copy-zip.ts`** – Copy and modify ZIP archives
71
+
72
+ Run an example:
73
+
74
+ ```bash
75
+ npx ts-node examples/create-zip.ts
76
+ ```
77
+
78
+ See [`examples/README.md`](examples/README.md) for details.
79
+
80
+ ## Blockchain integration
81
+
82
+ All blockchain code has been moved to a separate package. For timestamping, NFT tokenization, on-chain verification, wallet management, and OpenTimestamps, use **[neozip-blockchain](https://github.com/NeoWareInc/neozip-blockchain)**. It depends on NeoZipKit for ZIP handling and adds all blockchain features on top. NeoZipKit itself contains no blockchain, contract, or wallet code.
83
+
84
+ ## Package layout
85
+
86
+ - **`@neoware_inc/neozipkit`** – Main entry (core + platform detection)
87
+ - **`@neoware_inc/neozipkit/node`** – Node.js-only (ZipkitNode, file I/O, streaming)
88
+ - **`@neoware_inc/neozipkit/browser`** – Browser-only (ZipkitBrowser, Blob API)
89
+ - **`@neoware_inc/neozipkit/browser-esm`** – Browser ESM bundle (tree-shaking)
90
+
91
+ ## Development
92
+
93
+ ```bash
94
+ # Install
95
+ yarn install
96
+
97
+ # Build
98
+ yarn build
99
+
100
+ # Dev build (feature branches)
101
+ yarn dev:build
102
+
103
+ # Tests
104
+ yarn test
105
+ yarn test:examples
106
+ ```
107
+
108
+ See [`docs/DEV_BUILD.md`](docs/DEV_BUILD.md) for the development build system.
109
+
110
+ ## API overview
111
+
112
+ ### Core
113
+
114
+ - **Zipkit** – Core ZIP handling (buffer-based, shared)
115
+ - **ZipkitNode** – Node.js file-based operations (extends Zipkit)
116
+ - **ZipkitBrowser** – Browser Blob-based operations (extends Zipkit)
117
+ - **ZipEntry** – ZIP entry representation
118
+ - **ZipCompress** / **ZipDecompress** – Compression and decompression
119
+ - **HashCalculator** – CRC-32, SHA-256, Merkle root
120
+ - **EncryptionManager** / **ZipCrypto** – Encryption support
121
+
122
+ ### Compression methods
123
+
124
+ - **STORED (0)** – No compression
125
+ - **DEFLATED (8)** – Deflate (default)
126
+ - **ZSTD (93)** – Zstandard
127
+
128
+ ## Security
129
+
130
+ See [SECURITY.md](SECURITY.md) for security considerations and best practices.
131
+
132
+ ## License
133
+
134
+ MIT
@@ -0,0 +1,27 @@
1
+ import Zipkit, { CompressOptions, CreateZipOptions } from '../core';
2
+ import ZipEntry from '../core/ZipEntry';
3
+ import Errors from '../core/constants/Errors';
4
+ import * as Headers from '../core/constants/Headers';
5
+ import { sha256 } from '../core/encryption/ZipCrypto';
6
+ import { getTypeOf } from '../core/components/Util';
7
+ import type { FileData } from '../types';
8
+ export * from '../core';
9
+ export { ZipEntry, Errors, Headers, sha256, getTypeOf };
10
+ export default class ZipkitBrowser extends Zipkit {
11
+ constructor();
12
+ loadZipBlob(data: Blob): Promise<ZipEntry[] | null>;
13
+ createZipFileEntry(file: FileData): ZipEntry;
14
+ hashFile(file: FileData): Promise<string>;
15
+ compressDataBlob(entry: ZipEntry, data: Blob, options?: CompressOptions): Promise<Buffer>;
16
+ extractBlob(entry: ZipEntry, skipHashCheck?: boolean): Promise<Blob | null>;
17
+ createZipBlob(cmpOptions?: CompressOptions, options?: CreateZipOptions): Promise<Blob | null>;
18
+ /**
19
+ * Checks if a filename is a metadata file (META-INF) that should be excluded from Merkle Root calculation
20
+ * @param filename - The filename to check
21
+ * @returns boolean - True if the file is a metadata file
22
+ */
23
+ private isMetadataFile;
24
+ addFile(file: FileData, options?: CompressOptions): Promise<ZipEntry>;
25
+ verifyEntry(entry: ZipEntry, skipHashCheck?: boolean): Promise<boolean>;
26
+ }
27
+ //# sourceMappingURL=ZipkitBrowser.d.ts.map
@@ -0,0 +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,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAwGnG;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAUhB,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"}
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ // ======================================
3
+ // ZipkitBrowser.ts
4
+ // Copyright (c) 2025 NeoWare, Inc. All rights reserved.
5
+ // ======================================
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
40
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
41
+ };
42
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.getTypeOf = exports.sha256 = exports.Headers = exports.Errors = exports.ZipEntry = void 0;
47
+ const core_1 = __importDefault(require("../core"));
48
+ const ZipEntry_1 = __importDefault(require("../core/ZipEntry"));
49
+ exports.ZipEntry = ZipEntry_1.default;
50
+ const Errors_1 = __importDefault(require("../core/constants/Errors"));
51
+ exports.Errors = Errors_1.default;
52
+ const Headers = __importStar(require("../core/constants/Headers"));
53
+ exports.Headers = Headers;
54
+ const Headers_1 = require("../core/constants/Headers");
55
+ const ZipCrypto_1 = require("../core/encryption/ZipCrypto");
56
+ Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return ZipCrypto_1.sha256; } });
57
+ const Util_1 = require("../core/components/Util");
58
+ Object.defineProperty(exports, "getTypeOf", { enumerable: true, get: function () { return Util_1.getTypeOf; } });
59
+ // Re-export everything from Zipkit
60
+ __exportStar(require("../core"), exports);
61
+ // ======================================
62
+ // ZipkitBrowser
63
+ // ======================================
64
+ class ZipkitBrowser extends core_1.default {
65
+ constructor() {
66
+ super(); // Call the parent constructor
67
+ // console.log('Zipkit.support.isNode: ', Zipkit.support.isNode);
68
+ // console.log('Zipkit.support.buffer: ', Zipkit.support.buffer);
69
+ // console.log('Zipkit.support.blob: ', Zipkit.support.blob);
70
+ // console.log('Zipkit.support.streams: ', Zipkit.support.streams);
71
+ // console.log('Zipkit.support.fileReader: ', Zipkit.support.fileReader);
72
+ }
73
+ // --------------------------------------
74
+ // Load a ZIP file from a Blob and return the ZipEntry array
75
+ // Always uses loadZip() to ensure proper initialization
76
+ async loadZipBlob(data) {
77
+ if ((0, Util_1.getTypeOf)(data) !== Util_1.DATATYPE.BLOB) {
78
+ throw new Error(Errors_1.default.DATATYPE_UNSUPPORTED);
79
+ }
80
+ return new Promise((resolve, reject) => {
81
+ const reader = new window.FileReader();
82
+ reader.readAsArrayBuffer(data);
83
+ reader.onload = (e) => {
84
+ if (!reader.result) {
85
+ reject(new Error('Failed to read file'));
86
+ return;
87
+ }
88
+ try {
89
+ // Convert ArrayBuffer to Buffer
90
+ const buffer = Buffer.from(reader.result);
91
+ // Always use loadZip() which:
92
+ // 1. Resets ZIP data
93
+ // 2. Stores buffer in this.inBuffer
94
+ // 3. Loads EOCD and parses central directory
95
+ // 4. Stores entries in this.zipEntries
96
+ // 5. Returns the entries
97
+ const entries = super.loadZip(buffer);
98
+ resolve(entries);
99
+ }
100
+ catch (error) {
101
+ reject(error);
102
+ }
103
+ };
104
+ reader.onerror = () => {
105
+ reject(reader.error || new Error('Failed to read file'));
106
+ };
107
+ });
108
+ }
109
+ // --------------------------------------
110
+ // Create a ZipEntry for a File object
111
+ createZipFileEntry(file) {
112
+ const entry = super.createZipEntry(file.name);
113
+ entry.fileData = file;
114
+ entry.uncompressedSize = file.size;
115
+ const fileDate = new Date(file.lastModified);
116
+ entry.timeDateDOS = entry.setDateTime(fileDate);
117
+ entry.cmpMethod = Headers.CMP_METHOD.DEFLATED;
118
+ return entry;
119
+ }
120
+ // --------------------------------------
121
+ // Calculate the SHA256 hash of a File object
122
+ async hashFile(file) {
123
+ const arrayBuffer = await file.arrayBuffer();
124
+ const buffer = Buffer.from(arrayBuffer);
125
+ return (0, ZipCrypto_1.sha256)(buffer);
126
+ }
127
+ // --------------------------------------
128
+ // Compress the data and return the compressed data buffer
129
+ // Set the ZipEntry compressSize and CRC32 values
130
+ async compressDataBlob(entry, data, options) {
131
+ if ((0, Util_1.getTypeOf)(data) !== Util_1.DATATYPE.BLOB) {
132
+ throw new Error(Errors_1.default.DATATYPE_UNSUPPORTED);
133
+ }
134
+ return new Promise(async (resolve, reject) => {
135
+ const _compressData = async (entry, data, options) => {
136
+ // Use Zipkit wrapper method
137
+ return await this.compressData(entry, data, options);
138
+ };
139
+ const reader = new window.FileReader();
140
+ reader.readAsArrayBuffer(data);
141
+ reader.onload = async function (e) {
142
+ if (!this.result) {
143
+ reject(new Error('Failed to read file'));
144
+ return;
145
+ }
146
+ try {
147
+ const _inBuf = Buffer.from(this.result);
148
+ const result = await _compressData(entry, _inBuf, options);
149
+ resolve(result);
150
+ }
151
+ catch (error) {
152
+ reject(error);
153
+ }
154
+ };
155
+ reader.onerror = function (e) {
156
+ reject(this.error || new Error('Failed to read file'));
157
+ };
158
+ });
159
+ }
160
+ // --------------------------------------
161
+ // Extract a Blob from a ZipEntry
162
+ async extractBlob(entry, skipHashCheck) {
163
+ try {
164
+ const _outBuf = await this.extract(entry, skipHashCheck);
165
+ if (!_outBuf)
166
+ return null;
167
+ // Convert Buffer to Uint8Array for Blob compatibility
168
+ const uint8Array = new Uint8Array(_outBuf);
169
+ return new Blob([uint8Array], { type: 'application/octet-stream' });
170
+ }
171
+ catch (error) {
172
+ throw error;
173
+ }
174
+ }
175
+ // --------------------------------------
176
+ // Create a ZIP file in memory and return a Blob
177
+ async createZipBlob(cmpOptions, options) {
178
+ const _onError = options?.onError || (() => { });
179
+ const _onEntryDone = options?.onEntryDone || (() => { });
180
+ const zipEntries = super.getDirectory();
181
+ if (!zipEntries) {
182
+ _onError(new Error(Errors_1.default.NO_FILES));
183
+ return null;
184
+ }
185
+ let offset = 0;
186
+ const buffers = [];
187
+ for (const entry of zipEntries) {
188
+ if (!entry.isUpdated) {
189
+ // Check for META-INF metadata files even in copy mode
190
+ if (entry.filename === Headers_1.TOKENIZED_METADATA || entry.filename === Headers_1.TIMESTAMP_SUBMITTED || entry.filename === Headers_1.TIMESTAMP_METADATA) {
191
+ // Force this entry to be processed with special handling instead of copied
192
+ entry.isUpdated = true;
193
+ // Don't continue here - let it fall through to special handling below
194
+ }
195
+ else {
196
+ const inData = await super.copyEntry(entry);
197
+ entry.localHdrOffset = offset;
198
+ offset += inData.length;
199
+ buffers.push(inData);
200
+ _onEntryDone(entry, 'Copied');
201
+ continue;
202
+ }
203
+ }
204
+ if (!entry.fileData) {
205
+ _onError(new Error(Errors_1.default.FILE_NOT_FOUND));
206
+ return null;
207
+ }
208
+ const fileBuffer = await entry.fileData.arrayBuffer();
209
+ // Special handling for already-compressed entries - use existing compressed data
210
+ if (entry.cmpData && entry.compressedSize && entry.crc) {
211
+ // Entry is already compressed, use the existing compressed data
212
+ const localHdr = entry.createLocalHdr();
213
+ entry.localHdrOffset = offset;
214
+ offset += localHdr.length + entry.cmpData.length;
215
+ buffers.push(localHdr);
216
+ buffers.push(entry.cmpData);
217
+ _onEntryDone(entry, 'Written (pre-compressed)');
218
+ continue;
219
+ }
220
+ // Special handling for META-INF metadata files - store uncompressed with CRC-32
221
+ if (entry.filename === Headers_1.TOKENIZED_METADATA || entry.filename === Headers_1.TIMESTAMP_SUBMITTED || entry.filename === Headers_1.TIMESTAMP_METADATA) {
222
+ // For metadata files, use STORED compression (no compression)
223
+ const buffer = Buffer.from(fileBuffer);
224
+ // Calculate CRC-32 for the metadata file (not SHA-256 to avoid Merkle Root interference)
225
+ entry.crc = (0, ZipCrypto_1.crc32)(buffer);
226
+ // Set up entry for STORED compression
227
+ entry.cmpMethod = 0; // STORED
228
+ entry.compressedSize = buffer.length;
229
+ entry.uncompressedSize = buffer.length;
230
+ // Do NOT set SHA-256 hash for metadata files to avoid Merkle Root calculation
231
+ // entry.sha256 should remain undefined for metadata files
232
+ const localHdr = entry.createLocalHdr();
233
+ entry.localHdrOffset = offset;
234
+ offset += localHdr.length + buffer.length;
235
+ buffers.push(localHdr);
236
+ buffers.push(buffer);
237
+ _onEntryDone(entry, 'Stored (metadata)');
238
+ }
239
+ else {
240
+ // Normal file processing with compression
241
+ const cmpData = await this.compressData(entry, Buffer.from(fileBuffer), cmpOptions);
242
+ const localHdr = entry.createLocalHdr();
243
+ entry.localHdrOffset = offset;
244
+ offset += localHdr.length + cmpData.length;
245
+ buffers.push(localHdr);
246
+ buffers.push(cmpData);
247
+ _onEntryDone(entry, 'Written');
248
+ }
249
+ }
250
+ const centralDirOffset = offset;
251
+ for (const entry of zipEntries) {
252
+ const centralDirEntry = entry.centralDirEntry();
253
+ offset += centralDirEntry.length;
254
+ buffers.push(centralDirEntry);
255
+ }
256
+ const centralDirSize = offset - centralDirOffset;
257
+ const ceBuf = super.centralEndHdr(centralDirSize, centralDirOffset);
258
+ buffers.push(ceBuf);
259
+ const combinedBuffer = Buffer.concat(buffers);
260
+ // Convert Buffer to Uint8Array for Blob compatibility
261
+ const uint8Array = new Uint8Array(combinedBuffer);
262
+ return new Blob([uint8Array], { type: 'application/zip' });
263
+ }
264
+ /**
265
+ * Checks if a filename is a metadata file (META-INF) that should be excluded from Merkle Root calculation
266
+ * @param filename - The filename to check
267
+ * @returns boolean - True if the file is a metadata file
268
+ */
269
+ isMetadataFile(filename) {
270
+ return filename === Headers_1.TIMESTAMP_SUBMITTED ||
271
+ filename === Headers_1.TIMESTAMP_METADATA ||
272
+ filename === Headers_1.TOKENIZED_METADATA;
273
+ }
274
+ // --------------------------------------
275
+ // Helper method: Add a file to the ZIP with compression
276
+ // Simplifies the common workflow of creating entry + compressing
277
+ async addFile(file, options) {
278
+ // Create entry
279
+ const entry = this.createZipFileEntry(file);
280
+ // Compress the file
281
+ // In browser, File objects implement both FileData and Blob interfaces
282
+ // We need to convert FileData to Blob for compressDataBlob
283
+ const fileBlob = file;
284
+ const compressedData = await this.compressDataBlob(entry, fileBlob, options);
285
+ entry.cmpData = compressedData;
286
+ return entry;
287
+ }
288
+ // --------------------------------------
289
+ // Verify a ZIP entry by attempting to extract it
290
+ // Returns true if the entry is valid, false otherwise
291
+ async verifyEntry(entry, skipHashCheck) {
292
+ try {
293
+ const blob = await this.extractBlob(entry, skipHashCheck);
294
+ return blob !== null;
295
+ }
296
+ catch (error) {
297
+ console.error(`Verification failed for ${entry.filename}:`, error);
298
+ return false;
299
+ }
300
+ }
301
+ }
302
+ exports.default = ZipkitBrowser;
303
+ //# sourceMappingURL=ZipkitBrowser.js.map
@@ -0,0 +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,uDAAwG;AACxG,4DAA6D;AAOzB,uFAP3B,kBAAM,OAO2B;AAN1C,kDAA8D;AAMlB,0FANzB,gBAAS,OAMyB;AAFrD,mCAAmC;AACnC,0CAAwB;AAGxB,yCAAyC;AACzC,gBAAgB;AAChB,yCAAyC;AAEzC,MAAqB,aAAc,SAAQ,cAAM;IAC/C;QACE,KAAK,EAAE,CAAC,CAAM,8BAA8B;QAE5C,iEAAiE;QACjE,iEAAiE;QACjE,6DAA6D;QAC7D,mEAAmE;QACnE,yEAAyE;IAC3E,CAAC;IAED,yCAAyC;IACzC,4DAA4D;IAC5D,wDAAwD;IAExD,KAAK,CAAC,WAAW,CAAC,IAAU;QAC1B,IAAI,IAAA,gBAAS,EAAC,IAAI,CAAC,KAAK,eAAQ,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,gBAAM,CAAC,oBAAoB,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC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ser';
5
+ export declare const PlatformUtils: {
6
+ isBrowser: boolean;
7
+ isNode: string | false;
8
+ };
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAKA,cAAc,SAAS,CAAC;AACxB,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,eAAe,MAAM,CAAC;AAGtB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG3D,eAAO,MAAM,aAAa;;;CAKzB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export * from '../core';
2
+ export { default as ZipkitBrowser } from './ZipkitBrowser';
3
+ export { default as ZipEntry } from '../core/ZipEntry';
4
+ export type { CompressOptions, CreateZipOptions } from '../core/ZipCompress';
5
+ export type { FileData } from '../types';
6
+ export * from '../core/constants/Headers';
7
+ export * from '../core/constants/Errors';
8
+ export declare const PlatformUtils: {
9
+ isBrowser: boolean;
10
+ isNode: string | false;
11
+ };
12
+ //# sourceMappingURL=index.esm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["../../src/browser/index.esm.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAGzC,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // NeoZipkit - Browser ES Module Entry Point
4
+ // =============================================================================
5
+ // This is a clean ES module entry point for browser bundles
6
+ // All exports are named exports for better tree-shaking support
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.PlatformUtils = exports.ZipEntry = exports.ZipkitBrowser = void 0;
26
+ // Buffer polyfill for browser
27
+ const buffer_1 = require("buffer");
28
+ if (typeof globalThis !== 'undefined') {
29
+ globalThis.Buffer = buffer_1.Buffer;
30
+ }
31
+ // Core exports
32
+ __exportStar(require("../core"), exports);
33
+ // Browser-specific class
34
+ var ZipkitBrowser_1 = require("./ZipkitBrowser");
35
+ Object.defineProperty(exports, "ZipkitBrowser", { enumerable: true, get: function () { return __importDefault(ZipkitBrowser_1).default; } });
36
+ // Re-export ZipEntry as named export for convenience
37
+ var ZipEntry_1 = require("../core/ZipEntry");
38
+ Object.defineProperty(exports, "ZipEntry", { enumerable: true, get: function () { return __importDefault(ZipEntry_1).default; } });
39
+ __exportStar(require("../core/constants/Headers"), exports);
40
+ __exportStar(require("../core/constants/Errors"), exports);
41
+ // Platform utilities
42
+ exports.PlatformUtils = {
43
+ isBrowser: typeof window !== 'undefined' && typeof document !== 'undefined',
44
+ isNode: typeof process !== 'undefined' && process.versions && process.versions.node,
45
+ };
46
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sourceRoot":"","sources":["../../src/browser/index.esm.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,4CAA4C;AAC5C,gFAAgF;AAChF,4DAA4D;AAC5D,gEAAgE;;;;;;;;;;;;;;;;;;;;AAEhE,8BAA8B;AAC9B,mCAAgC;AAChC,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;IACrC,UAAkB,CAAC,MAAM,GAAG,eAAM,CAAC;AACtC,CAAC;AAED,eAAe;AACf,0CAAwB;AAExB,yBAAyB;AACzB,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AAEjC,qDAAqD;AACrD,6CAAuD;AAA9C,qHAAA,OAAO,OAAY;AAK5B,4DAA0C;AAC1C,2DAAyC;AAEzC,qBAAqB;AACR,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW;IAC3E,MAAM,EAAE,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI;CACpF,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // NeoZipkit - Browser-Only Package Exports
4
+ // =============================================================================
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.PlatformUtils = exports.ZipkitBrowser = void 0;
24
+ // Core shared exports (re-exported from core module)
25
+ __exportStar(require("../core"), exports);
26
+ const core_1 = __importDefault(require("../core"));
27
+ exports.default = core_1.default;
28
+ // Browser-only exports
29
+ var ZipkitBrowser_1 = require("./ZipkitBrowser");
30
+ Object.defineProperty(exports, "ZipkitBrowser", { enumerable: true, get: function () { return __importDefault(ZipkitBrowser_1).default; } });
31
+ // Platform-specific conditional exports
32
+ exports.PlatformUtils = {
33
+ // Browser detection
34
+ isBrowser: typeof window !== 'undefined' && typeof document !== 'undefined',
35
+ // Node.js detection
36
+ isNode: typeof process !== 'undefined' && process.versions && process.versions.node,
37
+ };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,2CAA2C;AAC3C,gFAAgF;;;;;;;;;;;;;;;;;;;;AAEhF,qDAAqD;AACrD,0CAAwB;AACxB,mDAA6B;AAC7B,kBAAe,cAAM,CAAC;AAEtB,uBAAuB;AACvB,iDAA2D;AAAlD,+HAAA,OAAO,OAAiB;AAEjC,wCAAwC;AAC3B,QAAA,aAAa,GAAG;IAC3B,oBAAoB;IACpB,SAAS,EAAE,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW;IAC3E,oBAAoB;IACpB,MAAM,EAAE,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI;CACpF,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from '../core';
2
+ import Zipkit from '../core';
3
+ export default Zipkit;
4
+ export { default as ZipkitBrowser } from './ZipkitBrowser';
5
+ export declare const PlatformUtils: {
6
+ isBrowser: boolean;
7
+ isNode: string | false;
8
+ };
9
+ //# sourceMappingURL=index.d.ts.map