@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
@@ -0,0 +1,647 @@
1
+ "use strict";
2
+ // ======================================
3
+ // Zipkit.ts - Enhanced Zipkit with Dual Mode Support
4
+ // Copyright (c) 2025 NeoWare, Inc. All rights reserved.
5
+ // ======================================
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.HDR_ID = exports.CENTRAL_DIRECTORY_END = exports.CENTRAL_FILE_HEADER = exports.LOCAL_FILE_HEADER = exports.GP_FLAG = exports.ZIP64_CENTRAL_DIR = exports.ZIP64_CENTRAL_END = exports.CENTRAL_DIR = exports.CENTRAL_END = exports.ENCRYPT_HDR_SIZE = exports.LOCAL_HDR = exports.TOKENIZED_METADATA = exports.TIMESTAMP_SUBMITTED = exports.TIMESTAMP_METADATA = exports.CMP_METHOD = exports.Errors = exports.ZipEntry = void 0;
11
+ const ZipEntry_1 = __importDefault(require("./ZipEntry"));
12
+ exports.ZipEntry = ZipEntry_1.default;
13
+ const Errors_1 = __importDefault(require("./constants/Errors"));
14
+ exports.Errors = Errors_1.default;
15
+ const Logger_1 = require("./components/Logger");
16
+ const types_1 = require("../types");
17
+ const ZipCompress_1 = require("./ZipCompress");
18
+ const ZipDecompress_1 = __importDefault(require("./ZipDecompress"));
19
+ const ZipCrypto_1 = require("./encryption/ZipCrypto");
20
+ const HashCalculator_1 = __importDefault(require("./components/HashCalculator"));
21
+ const Headers_1 = require("./constants/Headers");
22
+ Object.defineProperty(exports, "LOCAL_HDR", { enumerable: true, get: function () { return Headers_1.LOCAL_HDR; } });
23
+ Object.defineProperty(exports, "ENCRYPT_HDR_SIZE", { enumerable: true, get: function () { return Headers_1.ENCRYPT_HDR_SIZE; } });
24
+ Object.defineProperty(exports, "CMP_METHOD", { enumerable: true, get: function () { return Headers_1.CMP_METHOD; } });
25
+ Object.defineProperty(exports, "CENTRAL_END", { enumerable: true, get: function () { return Headers_1.CENTRAL_END; } });
26
+ Object.defineProperty(exports, "CENTRAL_DIR", { enumerable: true, get: function () { return Headers_1.CENTRAL_DIR; } });
27
+ Object.defineProperty(exports, "ZIP64_CENTRAL_END", { enumerable: true, get: function () { return Headers_1.ZIP64_CENTRAL_END; } });
28
+ Object.defineProperty(exports, "ZIP64_CENTRAL_DIR", { enumerable: true, get: function () { return Headers_1.ZIP64_CENTRAL_DIR; } });
29
+ Object.defineProperty(exports, "GP_FLAG", { enumerable: true, get: function () { return Headers_1.GP_FLAG; } });
30
+ Object.defineProperty(exports, "TIMESTAMP_SUBMITTED", { enumerable: true, get: function () { return Headers_1.TIMESTAMP_SUBMITTED; } });
31
+ Object.defineProperty(exports, "TIMESTAMP_METADATA", { enumerable: true, get: function () { return Headers_1.TIMESTAMP_METADATA; } });
32
+ Object.defineProperty(exports, "TOKENIZED_METADATA", { enumerable: true, get: function () { return Headers_1.TOKENIZED_METADATA; } });
33
+ Object.defineProperty(exports, "LOCAL_FILE_HEADER", { enumerable: true, get: function () { return Headers_1.LOCAL_FILE_HEADER; } });
34
+ Object.defineProperty(exports, "CENTRAL_FILE_HEADER", { enumerable: true, get: function () { return Headers_1.CENTRAL_FILE_HEADER; } });
35
+ Object.defineProperty(exports, "CENTRAL_DIRECTORY_END", { enumerable: true, get: function () { return Headers_1.CENTRAL_DIRECTORY_END; } });
36
+ Object.defineProperty(exports, "HDR_ID", { enumerable: true, get: function () { return Headers_1.HDR_ID; } });
37
+ /**
38
+ * Zipkit - Enhanced ZIP File Processing Library with Dual Mode Support
39
+ *
40
+ * Core ZIP file processing library supporting both buffer-based (in-memory) and
41
+ * file-based (streaming) modes. See README.md for detailed documentation.
42
+ *
43
+ * @class Zipkit
44
+ * @static {string} version - Library version string
45
+ * @static {string} releaseDate - Library release date
46
+ */
47
+ class Zipkit {
48
+ /**
49
+ * Creates a new Zipkit instance with optional configuration
50
+ *
51
+ * @param config - Optional configuration object (ZipkitConfig)
52
+ * - bufferSize: Buffer size for streaming operations (default: 512KB)
53
+ * - debug: Enable debug logging (default: false)
54
+ *
55
+ * @example
56
+ * const zip = new Zipkit({ bufferSize: 512 * 1024, debug: true });
57
+ */
58
+ constructor(config = {}) {
59
+ // In-memory mode data
60
+ this.inBuffer = null;
61
+ this.zipEntries = []; // Protected: single source of truth for ZIP entry order (accessible by subclasses)
62
+ this.centralDirSize = 0;
63
+ this.centralDirOffset = 0;
64
+ // Common data
65
+ this.zipComment = null;
66
+ // Private components (lazy-loaded)
67
+ this._zipkitCmp = null;
68
+ this._zipkitDeCmp = null;
69
+ this.config = {
70
+ bufferSize: config.bufferSize || 512 * 1024, // 512KB default (optimal for modern systems)
71
+ debug: config.debug || false // Default false
72
+ };
73
+ // Configure Logger based on debug setting
74
+ if (this.config.debug) {
75
+ Logger_1.Logger.setLevel('debug');
76
+ }
77
+ // Note: ZipCompress and ZipDecompress are lazy-loaded when first accessed
78
+ // ZSTD codec is also lazily initialized on first use (module-level singleton)
79
+ }
80
+ /**
81
+ * Lazy-load ZipCompress instance
82
+ * @returns ZipCompress instance (created on first access)
83
+ */
84
+ getZipCompress() {
85
+ if (!this._zipkitCmp) {
86
+ this._zipkitCmp = new ZipCompress_1.ZipCompress(this);
87
+ }
88
+ return this._zipkitCmp;
89
+ }
90
+ /**
91
+ * Lazy-load ZipDecompress instance
92
+ * @returns ZipDecompress instance (created on first access)
93
+ */
94
+ getZipDecompress() {
95
+ if (!this._zipkitDeCmp) {
96
+ this._zipkitDeCmp = new ZipDecompress_1.default(this);
97
+ }
98
+ return this._zipkitDeCmp;
99
+ }
100
+ /**
101
+ * Get the configured buffer size for streaming operations
102
+ * @returns Buffer size in bytes (default: 512KB)
103
+ */
104
+ getBufferSize() {
105
+ return this.config.bufferSize || 512 * 1024; // 512KB default (optimal for modern systems)
106
+ }
107
+ /**
108
+ * Check if ZIP is loaded in buffer mode
109
+ * @returns true if buffer-based ZIP is loaded
110
+ */
111
+ hasInBuffer() {
112
+ return this.inBuffer !== null && this.inBuffer.length > 0;
113
+ }
114
+ // ============================================================================
115
+ // ZipCompress Wrapper Methods
116
+ // ============================================================================
117
+ /**
118
+ * Compress data for a ZIP entry (Buffer-based only)
119
+ * Wrapper for ZipCompress.compressData()
120
+ *
121
+ * @param entry - ZIP entry to compress
122
+ * @param data - Buffer containing data to compress
123
+ * @param options - Compression options
124
+ * @param onOutputBuffer - Optional callback for streaming output
125
+ * @returns Promise resolving to Buffer containing compressed data
126
+ */
127
+ async compressData(entry, data, options, onOutputBuffer) {
128
+ return this.getZipCompress().compressData(entry, data, options, onOutputBuffer);
129
+ }
130
+ /**
131
+ * Compress data using deflate algorithm with chunked processing
132
+ * Wrapper for ZipCompress.deflateCompress()
133
+ *
134
+ * @param data - Data to compress (Buffer or chunked reader)
135
+ * @param options - Compression options
136
+ * @param bufferSize - Size of buffer to read (default: 512KB)
137
+ * @param entry - Optional ZIP entry for hash calculation
138
+ * @param onOutputBuffer - Optional callback for streaming output
139
+ * @returns Promise resolving to Buffer containing compressed data
140
+ */
141
+ async deflateCompress(data, options, bufferSize, entry, onOutputBuffer) {
142
+ return this.getZipCompress().deflateCompress(data, options, bufferSize, entry, onOutputBuffer);
143
+ }
144
+ /**
145
+ * Compress data using deflate algorithm (synchronous, small buffers only)
146
+ * Wrapper for ZipCompress.deflate()
147
+ *
148
+ * @param inbuf - Buffer containing data to compress
149
+ * @param options - Compression options
150
+ * @returns Buffer containing compressed data
151
+ */
152
+ deflate(inbuf, options) {
153
+ return this.getZipCompress().deflate(inbuf, options);
154
+ }
155
+ /**
156
+ * Compress data using Zstandard (zstd) algorithm
157
+ * Wrapper for ZipCompress.zstdCompress()
158
+ *
159
+ * Note: ZSTD codec is lazily initialized on first use (module-level singleton).
160
+ * Initialization happens automatically when needed.
161
+ *
162
+ * @param input - Buffer to compress OR chunked reader object
163
+ * @param options - Compression options
164
+ * @param bufferSize - Size of buffer to read if using chunked reader (default: 512KB)
165
+ * @param entry - Optional ZIP entry for hash calculation
166
+ * @param onOutputBuffer - Optional callback for streaming output
167
+ * @returns Promise resolving to Buffer containing compressed data
168
+ */
169
+ async zstdCompress(input, options, bufferSize, entry, onOutputBuffer) {
170
+ return this.getZipCompress().zstdCompress(input, options, bufferSize, entry, onOutputBuffer);
171
+ }
172
+ /**
173
+ * Compress file data in memory and return ZIP entry information as Buffer
174
+ * Wrapper for ZipCompress.compressFileBuffer()
175
+ *
176
+ * @param entry - ZIP entry to compress
177
+ * @param fileData - File data buffer to compress
178
+ * @param cmpOptions - Compression options
179
+ * @returns Promise resolving to Buffer containing local header + compressed data
180
+ */
181
+ async compressFileBuffer(entry, fileData, cmpOptions) {
182
+ return this.getZipCompress().compressFileBuffer(entry, fileData, cmpOptions);
183
+ }
184
+ // ============================================================================
185
+ // ZipDecompress Wrapper Methods
186
+ // ============================================================================
187
+ /**
188
+ * Extract file data (Buffer-based ZIP only)
189
+ * Wrapper for ZipDecompress.extract()
190
+ *
191
+ * @param entry - ZIP entry to extract
192
+ * @param skipHashCheck - Skip hash verification (CRC-32 or SHA-256)
193
+ * @returns Promise resolving to Buffer containing extracted data, or null if failed
194
+ * @throws Error if not a Buffer-based ZIP
195
+ */
196
+ async extract(entry, skipHashCheck) {
197
+ return this.getZipDecompress().extract(entry, skipHashCheck);
198
+ }
199
+ // ============================================================================
200
+ // Static Logging Wrapper Methods
201
+ // ============================================================================
202
+ /**
203
+ * Note: Logging for ZipCompress and ZipDecompress is controlled by their
204
+ * static loggingEnabled property. Set it directly:
205
+ * ZipCompress.loggingEnabled = true/false;
206
+ * ZipDecompress.loggingEnabled = true/false;
207
+ */
208
+ /**
209
+ * Load ZIP file from buffer (in-memory mode)
210
+ *
211
+ * **Required**: You must call this method (or the appropriate load method for your platform)
212
+ * before calling `getDirectory()` or any other ZIP operations. This method:
213
+ * 1. Resets all ZIP data
214
+ * 2. Stores the buffer in this.inBuffer
215
+ * 3. Loads EOCD and parses central directory
216
+ * 4. Populates this.zipEntries[] array
217
+ *
218
+ * For browser applications, use `ZipkitBrowser.loadZipBlob()` instead.
219
+ * For server applications with file paths, use `ZipkitServer.loadZipFile()` instead.
220
+ *
221
+ * @param inBuf - Buffer containing the complete ZIP file data
222
+ * @returns ZipEntry[] Array of all entries in the ZIP file
223
+ */
224
+ loadZip(inBuf) {
225
+ this.resetZipData();
226
+ // Store buffer for backward compatibility with detection logic
227
+ this.inBuffer = inBuf;
228
+ // Load EOCD and parse central directory
229
+ this.loadEOCDFromBuffer(inBuf);
230
+ const entries = this.getDirectoryFromBuffer();
231
+ this.zipEntries = entries;
232
+ return entries;
233
+ }
234
+ /**
235
+ * Reset all ZIP-related data to initial state
236
+ *
237
+ * Clears all internal state including zipEntries[], inBuffer, and zipComment.
238
+ *
239
+ * Note: ZipCompress and ZipDecompress instances are not recreated.
240
+ * ZSTD codec is a module-level singleton and is lazily initialized on first use,
241
+ * so no cleanup is needed. No memory buffers are allocated until compression/decompression
242
+ * operations are performed.
243
+ */
244
+ resetZipData() {
245
+ this.inBuffer = null;
246
+ this.zipEntries = [];
247
+ this.reset();
248
+ this.zipComment = null;
249
+ // Reset lazy-loaded components so they can be recreated on next access
250
+ this._zipkitCmp = null;
251
+ this._zipkitDeCmp = null;
252
+ // Note: ZSTD codec is module-level singleton, so no cleanup needed
253
+ }
254
+ /**
255
+ * Get central directory entries (synchronous, buffer-based only)
256
+ *
257
+ * Returns entries from zipEntries[] array which serves as unified storage.
258
+ *
259
+ * **Important**: This method does NOT load the ZIP file. You must call `loadZip()` first
260
+ * to populate zipEntries[]. If the ZIP is not loaded, this method returns an empty array.
261
+ *
262
+ * @param debug - Optional debug flag for logging
263
+ * @returns Array of ZipEntry objects, or empty array if ZIP not loaded
264
+ */
265
+ getDirectory(debug) {
266
+ return this.zipEntries;
267
+ }
268
+ /**
269
+ * Get specific ZIP entry by filename from zipEntries[] array
270
+ *
271
+ * @param filename - The name/path of the file/directory to find
272
+ * @returns ZipEntry object if found, null if not found
273
+ */
274
+ getZipEntry(filename) {
275
+ try {
276
+ const centralDir = this.getDirectory();
277
+ return centralDir.find((entry) => entry.filename === filename) || null;
278
+ }
279
+ catch (error) {
280
+ return null;
281
+ }
282
+ }
283
+ /**
284
+ * Ensure buffer is available (in-memory mode)
285
+ */
286
+ ensureBuffer() {
287
+ if (!this.inBuffer) {
288
+ this.inBuffer = Buffer.alloc(0);
289
+ }
290
+ return this.inBuffer;
291
+ }
292
+ /**
293
+ * Parse local header (in-memory mode)
294
+ */
295
+ parseLocalHeader(entry, buffer) {
296
+ const localData = buffer.subarray(entry.localHdrOffset);
297
+ if (localData.readUInt32LE(0) !== Headers_1.LOCAL_HDR.SIGNATURE) {
298
+ throw new Error(Errors_1.default.INVALID_CEN);
299
+ }
300
+ let _encryptLen = 0;
301
+ const _bitFlags = localData.readUInt16LE(Headers_1.LOCAL_HDR.FLAGS);
302
+ if (_bitFlags & Headers_1.GP_FLAG.ENCRYPTED) {
303
+ _encryptLen = Headers_1.ENCRYPT_HDR_SIZE;
304
+ }
305
+ let _fnameLen = localData.readUInt16LE(Headers_1.LOCAL_HDR.FNAME_LEN);
306
+ let _extraLen = localData.readUInt16LE(Headers_1.LOCAL_HDR.EXTRA_LEN);
307
+ let _localSize = Headers_1.LOCAL_HDR.SIZE + _fnameLen + _extraLen;
308
+ // For encrypted files: entry.compressedSize from central directory includes the 12-byte encryption header
309
+ // parseLocalHeader should return encrypted data WITHOUT the header (decryptBuffer will extract and prepend it)
310
+ // Structure: [local header][filename][extra][12-byte encryption header][encrypted compressed data]
311
+ // We need to read: encrypted compressed data (without the 12-byte header)
312
+ // Start: _localSize + _encryptLen (after the header)
313
+ // End: _localSize + entry.compressedSize (total includes header, so this gives us data without header)
314
+ const dataStart = _localSize + _encryptLen;
315
+ const dataEnd = _localSize + entry.compressedSize;
316
+ // Return encrypted data WITHOUT the encryption header
317
+ // decryptBuffer will extract the header from localSize to localSize+12 and prepend it
318
+ return localData.subarray(dataStart, dataEnd);
319
+ }
320
+ /**
321
+ * Test CRC32 checksum
322
+ * Always checks CRC against entry.crc from central directory
323
+ * For DATA_DESC files, CRC is stored in central directory, not local header
324
+ */
325
+ testCRC32(entry, data) {
326
+ // Always check CRC against entry.crc from central directory
327
+ // For DATA_DESC files, CRC is stored in central directory, not local header
328
+ const _crc = (0, ZipCrypto_1.crc32)(data);
329
+ const isValid = _crc === entry.crc;
330
+ Logger_1.Logger.debug(`[DEBUG] testCRC32() comparison: calculated=${_crc}, stored=${entry.crc}, isValid=${isValid ? '✓' : '✗'}, DATA_DESC=${(entry.bitFlags & 0x8) !== 0 ? 'YES' : 'NO'}`);
331
+ return isValid;
332
+ }
333
+ /**
334
+ * Test SHA256 hash
335
+ */
336
+ testSHA256(entry, data) {
337
+ if (!entry.sha256) {
338
+ throw new Error(Errors_1.default.UNKNOWN_SHA256);
339
+ }
340
+ const _sha256 = (0, ZipCrypto_1.sha256)(data);
341
+ const isValid = _sha256 === entry.sha256;
342
+ Logger_1.Logger.debug(`[DEBUG] testSHA256() comparison: calculated=${_sha256}, stored=${entry.sha256}, isValid=${isValid ? '✓' : '✗'}`);
343
+ return isValid;
344
+ }
345
+ /**
346
+ * Get memory usage statistics
347
+ *
348
+ * @returns Object containing backend type, total memory usage in bytes, and entry count
349
+ */
350
+ getMemoryUsage() {
351
+ const baseMemory = this.inBuffer?.length || 0;
352
+ const entriesMemory = this.zipEntries.length * 1024; // Approximate memory per entry
353
+ let backend;
354
+ if (this.inBuffer) {
355
+ backend = 'buffer';
356
+ }
357
+ else {
358
+ // Zipkit is buffer-based only, so if no buffer, backend is 'none'
359
+ // For file-based operations, use ZipkitServer
360
+ backend = 'none';
361
+ }
362
+ return {
363
+ backend,
364
+ memoryUsage: baseMemory + entriesMemory,
365
+ entries: this.zipEntries.length
366
+ };
367
+ }
368
+ /**
369
+ * Create a new ZIP entry and automatically add it to zipEntries[]
370
+ *
371
+ * @param filename - Entry filename
372
+ * @param data - Optional entry data (for CRC calculation)
373
+ * @param options - Optional entry options
374
+ * @returns Created ZipEntry instance
375
+ */
376
+ createZipEntry(filename, data, options) {
377
+ const entry = new ZipEntry_1.default(filename, null, false);
378
+ // Set basic properties
379
+ if (data) {
380
+ entry.crc = (0, ZipCrypto_1.crc32)(data);
381
+ entry.uncompressedSize = data.length;
382
+ entry.compressedSize = data.length;
383
+ }
384
+ else {
385
+ entry.crc = 0;
386
+ entry.uncompressedSize = 0;
387
+ entry.compressedSize = 0;
388
+ }
389
+ entry.cmpMethod = Headers_1.CMP_METHOD.STORED;
390
+ entry.bitFlags = 0;
391
+ // Note: lastModTime and lastModDate properties may not exist in ZipEntry
392
+ // entry.lastModTime = Math.floor(Date.now() / 1000);
393
+ // entry.lastModDate = Math.floor(Date.now() / 1000);
394
+ // Automatically add entry to zipEntries[] (maintains order as single source of truth)
395
+ this.zipEntries.push(entry);
396
+ return entry;
397
+ }
398
+ /**
399
+ * Copy entry from another ZIP (buffer-based only)
400
+ * For file-based ZIP operations, use ZipkitServer.copyEntry()
401
+ */
402
+ async copyEntry(sourceEntry) {
403
+ // For Buffer-based ZIP, we need to reconstruct the entry data
404
+ // This is a simplified version - in practice, you'd need to read from the original ZIP
405
+ if (sourceEntry.cmpData) {
406
+ const localHdr = sourceEntry.createLocalHdr();
407
+ return Buffer.concat([localHdr, sourceEntry.cmpData]);
408
+ }
409
+ throw new Error('Cannot copy entry: no compressed data available');
410
+ }
411
+ /**
412
+ * Central end header getter (for compatibility)
413
+ *
414
+ * Returns a function that creates the central end header using totalEntries from zipEntries[].
415
+ *
416
+ * @returns Function that creates central end header buffer
417
+ */
418
+ get centralEndHdr() {
419
+ // Return a function that calls centralEndHdr with totalEntries from zipEntries[]
420
+ return (centralDirSize, centralDirOffset) => {
421
+ const totalEntries = this.zipEntries.length;
422
+ return this.centralEndHdrMethod(centralDirSize, centralDirOffset, totalEntries);
423
+ };
424
+ }
425
+ /**
426
+ * Get ZIP comment
427
+ *
428
+ * @returns ZIP file comment string or null
429
+ */
430
+ getZipComment() {
431
+ return this.zipComment;
432
+ }
433
+ // ============================================================================
434
+ // Buffer-based ZIP Loading Methods (merged from ZipLoadEntries)
435
+ // ============================================================================
436
+ /**
437
+ * Load EOCD from in-memory buffer (buffer mode)
438
+ */
439
+ loadEOCDFromBuffer(buffer) {
440
+ const fileSize = buffer.length;
441
+ const searchSize = Math.min(0xFFFF + 22, fileSize);
442
+ const searchStart = fileSize - searchSize;
443
+ const scan = buffer.subarray(searchStart, searchStart + searchSize);
444
+ // Find EOCD signature
445
+ let eocdOffset = -1;
446
+ for (let i = scan.length - 22; i >= 0; i--) {
447
+ if (scan[i] === 0x50) {
448
+ if (scan.readUInt32LE(i) === Headers_1.CENTRAL_END.SIGNATURE) {
449
+ eocdOffset = searchStart + i;
450
+ break;
451
+ }
452
+ }
453
+ }
454
+ if (eocdOffset === -1) {
455
+ throw new Error(Errors_1.default.INVALID_FORMAT);
456
+ }
457
+ const eocdBuffer = buffer.subarray(eocdOffset, eocdOffset + 22);
458
+ if (eocdBuffer.readUInt32LE(0) === Headers_1.CENTRAL_END.SIGNATURE) {
459
+ this.centralDirSize = eocdBuffer.readUInt32LE(Headers_1.CENTRAL_END.CENTRAL_DIR_SIZE);
460
+ this.centralDirOffset = eocdBuffer.readUInt32LE(Headers_1.CENTRAL_END.CENTRAL_DIR_OFFSET);
461
+ if (this.centralDirOffset === 0xFFFFFFFF) {
462
+ // ZIP64: locate locator (20 bytes before EOCD) and then ZIP64 EOCD (56 bytes)
463
+ const locatorOffset = eocdOffset - 20;
464
+ const locatorBuffer = buffer.subarray(locatorOffset, locatorOffset + 20);
465
+ if (locatorBuffer.readUInt32LE(0) === Headers_1.ZIP64_CENTRAL_END.SIGNATURE) {
466
+ const zip64Offset = Number(locatorBuffer.readBigUInt64LE(8));
467
+ const zip64Buffer = buffer.subarray(zip64Offset, zip64Offset + 56);
468
+ this.centralDirSize = Number(zip64Buffer.readBigUInt64LE(Headers_1.ZIP64_CENTRAL_DIR.CENTRAL_DIR_SIZE));
469
+ this.centralDirOffset = Number(zip64Buffer.readBigUInt64LE(Headers_1.ZIP64_CENTRAL_DIR.CENTRAL_DIR_OFFSET));
470
+ }
471
+ }
472
+ }
473
+ else {
474
+ throw new Error(Errors_1.default.INVALID_FORMAT);
475
+ }
476
+ // ZIP comment
477
+ const commentLength = eocdBuffer.readUInt16LE(Headers_1.CENTRAL_END.ZIP_COMMENT_LEN);
478
+ if (commentLength > 0) {
479
+ const commentStart = eocdOffset + 22;
480
+ this.zipComment = buffer.subarray(commentStart, commentStart + commentLength).toString();
481
+ }
482
+ }
483
+ /**
484
+ * Get directory from buffer (buffer mode only)
485
+ * Note: zipEntries[] in Zipkit is the single source of truth for caching.
486
+ * This method always parses fresh from the buffer.
487
+ */
488
+ getDirectoryFromBuffer() {
489
+ if (!this.inBuffer) {
490
+ return [];
491
+ }
492
+ const buffer = this.inBuffer;
493
+ const entries = [];
494
+ let offset = this.centralDirOffset;
495
+ let remaining = this.centralDirSize;
496
+ const bufferSize = this.config.bufferSize || 512 * 1024;
497
+ while (remaining > 0) {
498
+ const currentBufferSize = Math.min(bufferSize, remaining);
499
+ const chunk = buffer.subarray(offset, offset + currentBufferSize);
500
+ // Parse entries from chunk
501
+ let chunkOffset = 0;
502
+ while (chunkOffset < chunk.length) {
503
+ if (chunk.readUInt32LE(chunkOffset) !== Headers_1.CENTRAL_DIR.SIGNATURE) {
504
+ break; // End of central directory
505
+ }
506
+ // Parse central directory entry
507
+ const entry = new ZipEntry_1.default(null, null, false);
508
+ const entryData = chunk.subarray(chunkOffset);
509
+ const remainingData = entry.readZipEntry(entryData);
510
+ entries.push(entry);
511
+ // Move to next entry
512
+ chunkOffset += (entryData.length - remainingData.length);
513
+ }
514
+ offset += currentBufferSize;
515
+ remaining -= currentBufferSize;
516
+ }
517
+ // Return entries in original order (do NOT sort by default)
518
+ // Central directory order should match data section order
519
+ // Note: zipEntries[] in Zipkit is the single source of truth for caching
520
+ return entries;
521
+ }
522
+ /**
523
+ * Reset internal state (private method for Zipkit to call)
524
+ * Clears all ZIP-related data while keeping the instance alive
525
+ */
526
+ reset() {
527
+ this.centralDirSize = 0;
528
+ this.centralDirOffset = 0;
529
+ }
530
+ /**
531
+ * Create central end header
532
+ * Note: totalEntries must be passed as parameter since zipEntries[] in Zipkit is the cache
533
+ */
534
+ centralEndHdrMethod(centralDirSize, centralDirOffset, totalEntries) {
535
+ const ceBuf = Buffer.alloc(Headers_1.CENTRAL_END.SIZE);
536
+ ceBuf.writeUInt32LE(Headers_1.CENTRAL_END.SIGNATURE, 0);
537
+ ceBuf.writeUInt16LE(0, 4); // Number of this disk
538
+ ceBuf.writeUInt16LE(0, 6); // Number of the disk with the start of the central directory
539
+ ceBuf.writeUInt16LE(totalEntries, 8); // Total number of entries
540
+ ceBuf.writeUInt16LE(totalEntries, 10); // Total number of entries on this disk
541
+ ceBuf.writeUInt32LE(centralDirSize, 12); // Size of central directory
542
+ ceBuf.writeUInt32LE(centralDirOffset, 16); // Offset of start of central directory
543
+ ceBuf.writeUInt16LE(0, 20); // ZIP file comment length
544
+ return ceBuf;
545
+ }
546
+ /**
547
+ * Calculate Merkle Root of the ZIP file
548
+ *
549
+ * Excludes metadata files (META-INF) to ensure consistent calculation.
550
+ * Simply calls getDirectory() and returns null if empty.
551
+ *
552
+ * @returns Merkle root string or null if calculation fails
553
+ */
554
+ getMerkleRoot() {
555
+ // Simply get directory - no loading logic
556
+ let zipEntries;
557
+ try {
558
+ zipEntries = this.getDirectory();
559
+ }
560
+ catch (error) {
561
+ // Catch any errors from getDirectory() - this should never happen
562
+ // but if it does, log it and return null
563
+ Logger_1.Logger.error(`getMerkleRoot(): Error calling getDirectory(): ${error instanceof Error ? error.message : String(error)}`);
564
+ Logger_1.Logger.error(`getMerkleRoot(): Stack trace: ${error instanceof Error ? error.stack : 'No stack trace'}`);
565
+ return null;
566
+ }
567
+ if (!zipEntries || zipEntries.length === 0) {
568
+ return null;
569
+ }
570
+ const hashAccumulator = new HashCalculator_1.default({ enableAccumulation: true });
571
+ // Filter out metadata files (META-INF) to ensure consistent Merkle Root calculation
572
+ // Inline check to avoid conflict with ZipkitBrowser's isMetadataFile() method
573
+ const contentEntries = zipEntries.filter(entry => {
574
+ const filename = entry.filename || '';
575
+ return filename !== Headers_1.TIMESTAMP_SUBMITTED &&
576
+ filename !== Headers_1.TIMESTAMP_METADATA &&
577
+ filename !== Headers_1.TOKENIZED_METADATA;
578
+ });
579
+ for (const entry of contentEntries) {
580
+ if (entry.sha256) {
581
+ // Convert hex string to Buffer
582
+ const hashBuffer = Buffer.from(entry.sha256, 'hex');
583
+ hashAccumulator.addHash(hashBuffer);
584
+ }
585
+ }
586
+ const merkleRoot = hashAccumulator.merkleRoot();
587
+ if (!merkleRoot) {
588
+ return null;
589
+ }
590
+ return merkleRoot;
591
+ }
592
+ /**
593
+ * Calculate Merkle Root of the ZIP file asynchronously
594
+ *
595
+ * Excludes metadata files (META-INF) to ensure consistent calculation.
596
+ * Works with both buffer-based and file-based ZIPs.
597
+ *
598
+ * @returns Promise resolving to Merkle root string or null if calculation fails
599
+ */
600
+ async getMerkleRootAsync() {
601
+ let zipEntries = [];
602
+ try {
603
+ // Get entries based on ZIP type
604
+ if (this.inBuffer) {
605
+ zipEntries = this.getDirectory();
606
+ }
607
+ else {
608
+ // File-based: cannot get entries synchronously - return null
609
+ // Caller should use ZipkitServer.getMerkleRootAsync() for file-based ZIPs
610
+ Logger_1.Logger.error('getMerkleRootAsync() called on file-based ZIP. Use ZipkitServer.getMerkleRootAsync() instead.');
611
+ return null;
612
+ }
613
+ }
614
+ catch (error) {
615
+ Logger_1.Logger.error(`Failed to get directory for merkle root calculation: ${error instanceof Error ? error.message : String(error)}`);
616
+ return null;
617
+ }
618
+ if (!zipEntries || zipEntries.length === 0) {
619
+ return null;
620
+ }
621
+ const hashAccumulator = new HashCalculator_1.default({ enableAccumulation: true });
622
+ // Filter out metadata files (META-INF) to ensure consistent Merkle Root calculation
623
+ // Inline check to avoid conflict with ZipkitBrowser's isMetadataFile() method
624
+ const contentEntries = zipEntries.filter(entry => {
625
+ const filename = entry.filename || '';
626
+ return filename !== Headers_1.TIMESTAMP_SUBMITTED &&
627
+ filename !== Headers_1.TIMESTAMP_METADATA &&
628
+ filename !== Headers_1.TOKENIZED_METADATA;
629
+ });
630
+ for (const entry of contentEntries) {
631
+ if (entry.sha256) {
632
+ // Convert hex string to Buffer
633
+ const hashBuffer = Buffer.from(entry.sha256, 'hex');
634
+ hashAccumulator.addHash(hashBuffer);
635
+ }
636
+ }
637
+ const merkleRoot = hashAccumulator.merkleRoot();
638
+ if (!merkleRoot) {
639
+ return null;
640
+ }
641
+ return merkleRoot;
642
+ }
643
+ }
644
+ Zipkit.version = types_1.NEOZIPKIT_INFO.version;
645
+ Zipkit.releaseDate = types_1.NEOZIPKIT_INFO.releaseDate;
646
+ exports.default = Zipkit;
647
+ //# sourceMappingURL=Zipkit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Zipkit.js","sourceRoot":"","sources":["../../src/core/Zipkit.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,qDAAqD;AACrD,yDAAyD;AACzD,yCAAyC;;;;;;AAEzC,0DAAkC;AAsChC,mBAtCK,kBAAQ,CAsCL;AArCV,gEAAwC;AAsCtC,iBAtCK,gBAAM,CAsCL;AArCR,gDAA6C;AAC7C,oCAA0C;AAC1C,+CAA6D;AAC7D,oEAA4C;AAC5C,sDAAuD;AACvD,iFAAyD;AACzD,iDAgB6B;AAoB3B,0FAnCA,mBAAS,OAmCA;AACT,iGAnCA,0BAAgB,OAmCA;AALhB,2FA7BA,oBAAU,OA6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