@cj-tech-master/excelts 4.2.1-canary.20260111102127.f808a37 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/THIRD_PARTY_NOTICES.md +31 -0
  2. package/dist/browser/index.browser.d.ts +0 -1
  3. package/dist/browser/index.browser.js +0 -12
  4. package/dist/browser/modules/archive/byte-queue.d.ts +18 -0
  5. package/dist/browser/modules/archive/byte-queue.js +125 -0
  6. package/dist/browser/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
  7. package/dist/browser/modules/archive/{compression/compress.browser.d.ts → compress.browser.d.ts} +8 -2
  8. package/dist/{esm/modules/archive/compression → browser/modules/archive}/compress.browser.js +11 -3
  9. package/dist/browser/modules/archive/{compression/compress.d.ts → compress.d.ts} +2 -2
  10. package/dist/{esm/modules/archive/compression → browser/modules/archive}/compress.js +1 -1
  11. package/dist/browser/modules/archive/{compression/crc32.browser.d.ts → crc32.browser.d.ts} +1 -1
  12. package/dist/browser/modules/archive/{compression/crc32.d.ts → crc32.d.ts} +1 -1
  13. package/dist/browser/modules/archive/{compression/crc32.js → crc32.js} +1 -1
  14. package/dist/browser/modules/archive/defaults.d.ts +0 -1
  15. package/dist/browser/modules/archive/defaults.js +3 -6
  16. package/dist/browser/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
  17. package/dist/browser/modules/archive/{unzip/extract.d.ts → extract.d.ts} +2 -2
  18. package/dist/browser/modules/archive/index.base.d.ts +4 -4
  19. package/dist/browser/modules/archive/index.base.js +6 -3
  20. package/dist/browser/modules/archive/index.browser.d.ts +4 -3
  21. package/dist/browser/modules/archive/index.browser.js +7 -3
  22. package/dist/browser/modules/archive/index.d.ts +4 -3
  23. package/dist/browser/modules/archive/index.js +5 -3
  24. package/dist/browser/modules/archive/{unzip/stream.base.d.ts → parse.base.d.ts} +2 -36
  25. package/dist/browser/modules/archive/parse.base.js +644 -0
  26. package/dist/browser/modules/archive/{unzip/stream.browser.d.ts → parse.browser.d.ts} +1 -1
  27. package/dist/{esm/modules/archive/unzip/stream.browser.js → browser/modules/archive/parse.browser.js} +110 -371
  28. package/dist/browser/modules/archive/{unzip/stream.d.ts → parse.d.ts} +2 -2
  29. package/dist/{esm/modules/archive/unzip/stream.js → browser/modules/archive/parse.js} +5 -6
  30. package/dist/browser/modules/archive/{compression/streaming-compress.browser.d.ts → streaming-compress.browser.d.ts} +2 -2
  31. package/dist/browser/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
  32. package/dist/browser/modules/archive/{compression/streaming-compress.d.ts → streaming-compress.d.ts} +2 -2
  33. package/dist/browser/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
  34. package/dist/browser/modules/archive/{zip/stream.d.ts → streaming-zip.d.ts} +5 -28
  35. package/dist/{esm/modules/archive/zip/stream.js → browser/modules/archive/streaming-zip.js} +48 -192
  36. package/dist/browser/modules/archive/utils/bytes.js +16 -16
  37. package/dist/browser/modules/archive/utils/parse-buffer.js +23 -21
  38. package/dist/browser/modules/archive/utils/timestamps.js +1 -62
  39. package/dist/browser/modules/archive/utils/zip-extra-fields.d.ts +1 -1
  40. package/dist/browser/modules/archive/utils/zip-extra-fields.js +14 -26
  41. package/dist/browser/modules/archive/utils/zip-extra.d.ts +18 -0
  42. package/dist/browser/modules/archive/utils/zip-extra.js +68 -0
  43. package/dist/browser/modules/archive/zip-builder.d.ts +117 -0
  44. package/dist/browser/modules/archive/zip-builder.js +292 -0
  45. package/dist/browser/modules/archive/zip-constants.d.ts +18 -0
  46. package/dist/browser/modules/archive/zip-constants.js +23 -0
  47. package/dist/{esm/modules/archive/zip → browser/modules/archive}/zip-entry-metadata.js +3 -3
  48. package/dist/{types/modules/archive/unzip → browser/modules/archive}/zip-parser.d.ts +1 -1
  49. package/dist/{esm/modules/archive/unzip → browser/modules/archive}/zip-parser.js +24 -38
  50. package/dist/browser/modules/archive/{zip-spec/zip-records.d.ts → zip-records.d.ts} +0 -20
  51. package/dist/browser/modules/archive/zip-records.js +84 -0
  52. package/dist/browser/modules/excel/stream/workbook-reader.browser.js +1 -1
  53. package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
  54. package/dist/browser/modules/excel/stream/workbook-writer.browser.js +1 -1
  55. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +6 -3
  56. package/dist/browser/modules/excel/xlsx/xlsx.js +1 -1
  57. package/dist/browser/modules/stream/streams.browser.d.ts +30 -28
  58. package/dist/browser/modules/stream/streams.browser.js +710 -830
  59. package/dist/browser/modules/stream/streams.js +58 -140
  60. package/dist/cjs/modules/archive/byte-queue.js +129 -0
  61. package/dist/cjs/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
  62. package/dist/cjs/modules/archive/{compression/compress.browser.js → compress.browser.js} +11 -3
  63. package/dist/cjs/modules/archive/{compression/compress.js → compress.js} +1 -1
  64. package/dist/cjs/modules/archive/{compression/crc32.js → crc32.js} +1 -1
  65. package/dist/cjs/modules/archive/defaults.js +4 -7
  66. package/dist/cjs/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
  67. package/dist/cjs/modules/archive/index.base.js +19 -9
  68. package/dist/cjs/modules/archive/index.browser.js +10 -4
  69. package/dist/cjs/modules/archive/index.js +8 -4
  70. package/dist/cjs/modules/archive/parse.base.js +666 -0
  71. package/dist/cjs/modules/archive/{unzip/stream.browser.js → parse.browser.js} +111 -372
  72. package/dist/cjs/modules/archive/{unzip/stream.js → parse.js} +8 -9
  73. package/dist/cjs/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
  74. package/dist/cjs/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
  75. package/dist/cjs/modules/archive/{zip/stream.js → streaming-zip.js} +50 -194
  76. package/dist/cjs/modules/archive/utils/bytes.js +16 -16
  77. package/dist/cjs/modules/archive/utils/parse-buffer.js +23 -21
  78. package/dist/cjs/modules/archive/utils/timestamps.js +3 -64
  79. package/dist/cjs/modules/archive/utils/zip-extra-fields.js +14 -26
  80. package/dist/cjs/modules/archive/utils/zip-extra.js +74 -0
  81. package/dist/cjs/modules/archive/zip-builder.js +297 -0
  82. package/dist/cjs/modules/archive/zip-constants.js +26 -0
  83. package/dist/cjs/modules/archive/{zip/zip-entry-metadata.js → zip-entry-metadata.js} +5 -5
  84. package/dist/cjs/modules/archive/{unzip/zip-parser.js → zip-parser.js} +33 -47
  85. package/dist/cjs/modules/archive/zip-records.js +90 -0
  86. package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +2 -2
  87. package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +4 -4
  88. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +9 -6
  89. package/dist/cjs/modules/excel/xlsx/xlsx.js +2 -2
  90. package/dist/cjs/modules/stream/streams.browser.js +710 -830
  91. package/dist/cjs/modules/stream/streams.js +58 -140
  92. package/dist/esm/index.browser.js +0 -12
  93. package/dist/esm/modules/archive/byte-queue.js +125 -0
  94. package/dist/esm/modules/archive/{compression/compress.base.js → compress.base.js} +1 -1
  95. package/dist/{browser/modules/archive/compression → esm/modules/archive}/compress.browser.js +11 -3
  96. package/dist/{browser/modules/archive/compression → esm/modules/archive}/compress.js +1 -1
  97. package/dist/esm/modules/archive/{compression/crc32.js → crc32.js} +1 -1
  98. package/dist/esm/modules/archive/defaults.js +3 -6
  99. package/dist/esm/modules/archive/{compression/deflate-fallback.js → deflate-fallback.js} +1 -1
  100. package/dist/esm/modules/archive/index.base.js +6 -3
  101. package/dist/esm/modules/archive/index.browser.js +7 -3
  102. package/dist/esm/modules/archive/index.js +5 -3
  103. package/dist/esm/modules/archive/parse.base.js +644 -0
  104. package/dist/{browser/modules/archive/unzip/stream.browser.js → esm/modules/archive/parse.browser.js} +110 -371
  105. package/dist/{browser/modules/archive/unzip/stream.js → esm/modules/archive/parse.js} +5 -6
  106. package/dist/esm/modules/archive/{compression/streaming-compress.browser.js → streaming-compress.browser.js} +3 -3
  107. package/dist/esm/modules/archive/{compression/streaming-compress.js → streaming-compress.js} +2 -2
  108. package/dist/{browser/modules/archive/zip/stream.js → esm/modules/archive/streaming-zip.js} +48 -192
  109. package/dist/esm/modules/archive/utils/bytes.js +16 -16
  110. package/dist/esm/modules/archive/utils/parse-buffer.js +23 -21
  111. package/dist/esm/modules/archive/utils/timestamps.js +1 -62
  112. package/dist/esm/modules/archive/utils/zip-extra-fields.js +14 -26
  113. package/dist/esm/modules/archive/utils/zip-extra.js +68 -0
  114. package/dist/esm/modules/archive/zip-builder.js +292 -0
  115. package/dist/esm/modules/archive/zip-constants.js +23 -0
  116. package/dist/{browser/modules/archive/zip → esm/modules/archive}/zip-entry-metadata.js +3 -3
  117. package/dist/{browser/modules/archive/unzip → esm/modules/archive}/zip-parser.js +24 -38
  118. package/dist/esm/modules/archive/zip-records.js +84 -0
  119. package/dist/esm/modules/excel/stream/workbook-reader.browser.js +1 -1
  120. package/dist/esm/modules/excel/stream/workbook-writer.browser.js +1 -1
  121. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +6 -3
  122. package/dist/esm/modules/excel/xlsx/xlsx.js +1 -1
  123. package/dist/esm/modules/stream/streams.browser.js +710 -830
  124. package/dist/esm/modules/stream/streams.js +58 -140
  125. package/dist/iife/THIRD_PARTY_NOTICES.md +31 -0
  126. package/dist/iife/excelts.iife.js +4425 -6215
  127. package/dist/iife/excelts.iife.js.map +1 -1
  128. package/dist/iife/excelts.iife.min.js +31 -103
  129. package/dist/types/index.browser.d.ts +0 -1
  130. package/dist/types/modules/archive/byte-queue.d.ts +18 -0
  131. package/dist/types/modules/archive/{compression/compress.browser.d.ts → compress.browser.d.ts} +8 -2
  132. package/dist/types/modules/archive/defaults.d.ts +0 -1
  133. package/dist/types/modules/archive/index.base.d.ts +4 -4
  134. package/dist/types/modules/archive/index.browser.d.ts +4 -3
  135. package/dist/types/modules/archive/index.d.ts +4 -3
  136. package/dist/types/modules/archive/{unzip/stream.base.d.ts → parse.base.d.ts} +4 -38
  137. package/dist/types/modules/archive/{unzip/stream.browser.d.ts → parse.browser.d.ts} +2 -2
  138. package/dist/types/modules/archive/{unzip/stream.d.ts → parse.d.ts} +3 -3
  139. package/dist/types/modules/archive/{compression/streaming-compress.browser.d.ts → streaming-compress.browser.d.ts} +1 -1
  140. package/dist/types/modules/archive/{zip/stream.d.ts → streaming-zip.d.ts} +6 -29
  141. package/dist/types/modules/archive/utils/zip-extra-fields.d.ts +1 -1
  142. package/dist/types/modules/archive/utils/zip-extra.d.ts +18 -0
  143. package/dist/types/modules/archive/zip-builder.d.ts +117 -0
  144. package/dist/types/modules/archive/zip-constants.d.ts +18 -0
  145. package/dist/types/modules/archive/{zip/zip-entry-metadata.d.ts → zip-entry-metadata.d.ts} +1 -1
  146. package/dist/{browser/modules/archive/unzip → types/modules/archive}/zip-parser.d.ts +1 -1
  147. package/dist/types/modules/archive/{zip-spec/zip-records.d.ts → zip-records.d.ts} +0 -20
  148. package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
  149. package/dist/types/modules/stream/streams.browser.d.ts +30 -28
  150. package/package.json +1 -5
  151. package/dist/browser/modules/archive/internal/byte-queue.d.ts +0 -33
  152. package/dist/browser/modules/archive/internal/byte-queue.js +0 -407
  153. package/dist/browser/modules/archive/io/archive-sink.d.ts +0 -9
  154. package/dist/browser/modules/archive/io/archive-sink.js +0 -77
  155. package/dist/browser/modules/archive/io/archive-source.d.ts +0 -8
  156. package/dist/browser/modules/archive/io/archive-source.js +0 -107
  157. package/dist/browser/modules/archive/unzip/index.d.ts +0 -40
  158. package/dist/browser/modules/archive/unzip/index.js +0 -164
  159. package/dist/browser/modules/archive/unzip/stream.base.js +0 -1022
  160. package/dist/browser/modules/archive/utils/async-queue.d.ts +0 -7
  161. package/dist/browser/modules/archive/utils/async-queue.js +0 -103
  162. package/dist/browser/modules/archive/utils/compressibility.d.ts +0 -10
  163. package/dist/browser/modules/archive/utils/compressibility.js +0 -57
  164. package/dist/browser/modules/archive/utils/pattern-scanner.d.ts +0 -21
  165. package/dist/browser/modules/archive/utils/pattern-scanner.js +0 -27
  166. package/dist/browser/modules/archive/zip/index.d.ts +0 -42
  167. package/dist/browser/modules/archive/zip/index.js +0 -157
  168. package/dist/browser/modules/archive/zip/zip-bytes.d.ts +0 -73
  169. package/dist/browser/modules/archive/zip/zip-bytes.js +0 -239
  170. package/dist/browser/modules/archive/zip-spec/zip-records.js +0 -126
  171. package/dist/cjs/modules/archive/internal/byte-queue.js +0 -411
  172. package/dist/cjs/modules/archive/io/archive-sink.js +0 -82
  173. package/dist/cjs/modules/archive/io/archive-source.js +0 -114
  174. package/dist/cjs/modules/archive/unzip/index.js +0 -170
  175. package/dist/cjs/modules/archive/unzip/stream.base.js +0 -1044
  176. package/dist/cjs/modules/archive/utils/async-queue.js +0 -106
  177. package/dist/cjs/modules/archive/utils/compressibility.js +0 -60
  178. package/dist/cjs/modules/archive/utils/pattern-scanner.js +0 -31
  179. package/dist/cjs/modules/archive/zip/index.js +0 -162
  180. package/dist/cjs/modules/archive/zip/zip-bytes.js +0 -242
  181. package/dist/cjs/modules/archive/zip-spec/zip-records.js +0 -136
  182. package/dist/esm/modules/archive/internal/byte-queue.js +0 -407
  183. package/dist/esm/modules/archive/io/archive-sink.js +0 -77
  184. package/dist/esm/modules/archive/io/archive-source.js +0 -107
  185. package/dist/esm/modules/archive/unzip/index.js +0 -164
  186. package/dist/esm/modules/archive/unzip/stream.base.js +0 -1022
  187. package/dist/esm/modules/archive/utils/async-queue.js +0 -103
  188. package/dist/esm/modules/archive/utils/compressibility.js +0 -57
  189. package/dist/esm/modules/archive/utils/pattern-scanner.js +0 -27
  190. package/dist/esm/modules/archive/zip/index.js +0 -157
  191. package/dist/esm/modules/archive/zip/zip-bytes.js +0 -239
  192. package/dist/esm/modules/archive/zip-spec/zip-records.js +0 -126
  193. package/dist/types/modules/archive/internal/byte-queue.d.ts +0 -33
  194. package/dist/types/modules/archive/io/archive-sink.d.ts +0 -9
  195. package/dist/types/modules/archive/io/archive-source.d.ts +0 -8
  196. package/dist/types/modules/archive/unzip/index.d.ts +0 -40
  197. package/dist/types/modules/archive/utils/async-queue.d.ts +0 -7
  198. package/dist/types/modules/archive/utils/compressibility.d.ts +0 -10
  199. package/dist/types/modules/archive/utils/pattern-scanner.d.ts +0 -21
  200. package/dist/types/modules/archive/zip/index.d.ts +0 -42
  201. package/dist/types/modules/archive/zip/zip-bytes.d.ts +0 -73
  202. /package/dist/browser/modules/archive/{compression/compress.base.d.ts → compress.base.d.ts} +0 -0
  203. /package/dist/browser/modules/archive/{compression/crc32.base.d.ts → crc32.base.d.ts} +0 -0
  204. /package/dist/browser/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
  205. /package/dist/browser/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
  206. /package/dist/browser/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts} +0 -0
  207. /package/dist/browser/modules/archive/{unzip/extract.js → extract.js} +0 -0
  208. /package/dist/browser/modules/archive/{compression/streaming-compress.base.d.ts → streaming-compress.base.d.ts} +0 -0
  209. /package/dist/browser/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
  210. /package/dist/browser/modules/archive/{zip-spec/zip-entry-info.d.ts → zip-entry-info.d.ts} +0 -0
  211. /package/dist/browser/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
  212. /package/dist/browser/modules/archive/{zip/zip-entry-metadata.d.ts → zip-entry-metadata.d.ts} +0 -0
  213. /package/dist/cjs/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
  214. /package/dist/cjs/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
  215. /package/dist/cjs/modules/archive/{unzip/extract.js → extract.js} +0 -0
  216. /package/dist/cjs/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
  217. /package/dist/cjs/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
  218. /package/dist/esm/modules/archive/{compression/crc32.base.js → crc32.base.js} +0 -0
  219. /package/dist/esm/modules/archive/{compression/crc32.browser.js → crc32.browser.js} +0 -0
  220. /package/dist/esm/modules/archive/{unzip/extract.js → extract.js} +0 -0
  221. /package/dist/esm/modules/archive/{compression/streaming-compress.base.js → streaming-compress.base.js} +0 -0
  222. /package/dist/esm/modules/archive/{zip-spec/zip-entry-info.js → zip-entry-info.js} +0 -0
  223. /package/dist/types/modules/archive/{compression/compress.base.d.ts → compress.base.d.ts} +0 -0
  224. /package/dist/types/modules/archive/{compression/compress.d.ts → compress.d.ts} +0 -0
  225. /package/dist/types/modules/archive/{compression/crc32.base.d.ts → crc32.base.d.ts} +0 -0
  226. /package/dist/types/modules/archive/{compression/crc32.browser.d.ts → crc32.browser.d.ts} +0 -0
  227. /package/dist/types/modules/archive/{compression/crc32.d.ts → crc32.d.ts} +0 -0
  228. /package/dist/types/modules/archive/{compression/deflate-fallback.d.ts → deflate-fallback.d.ts} +0 -0
  229. /package/dist/types/modules/archive/{unzip/extract.d.ts → extract.d.ts} +0 -0
  230. /package/dist/types/modules/archive/{compression/streaming-compress.base.d.ts → streaming-compress.base.d.ts} +0 -0
  231. /package/dist/types/modules/archive/{compression/streaming-compress.d.ts → streaming-compress.d.ts} +0 -0
  232. /package/dist/types/modules/archive/{zip-spec/zip-entry-info.d.ts → zip-entry-info.d.ts} +0 -0
@@ -25,4 +25,3 @@ export { WorkbookWriter, WorkbookReader, WorksheetWriter, WorksheetReader };
25
25
  export type { CsvReadOptions, CsvWriteOptions, CsvStreamReadOptions, CsvStreamWriteOptions } from "./modules/csv/csv.browser.js";
26
26
  export { CsvParserStream, CsvFormatterStream } from "./modules/csv/csv.browser.js";
27
27
  export * from "./modules/excel/utils/sheet-utils.js";
28
- export { zip, unzip, ZipArchive, ZipReader, UnzipEntry, type ZipOptions, type ZipEntryOptions, type UnzipOptions, type ArchiveSource, type ArchiveSink, crc32, crc32Update, crc32Finalize, compress, compressSync, decompress, decompressSync, hasCompressionStream, type CompressOptions, createDeflateStream, createInflateStream, hasDeflateRaw, type StreamCompressOptions } from "./modules/archive/index.browser.js";
@@ -0,0 +1,18 @@
1
+ export declare class ByteQueue {
2
+ private static readonly EMPTY;
3
+ private _buf;
4
+ private _start;
5
+ private _end;
6
+ private _cachedView;
7
+ private _cachedBuf;
8
+ private _cachedStart;
9
+ private _cachedEnd;
10
+ constructor(initial?: Uint8Array);
11
+ get length(): number;
12
+ isEmpty(): boolean;
13
+ view(): Uint8Array;
14
+ reset(data?: Uint8Array): void;
15
+ append(chunk: Uint8Array): void;
16
+ read(length: number): Uint8Array;
17
+ discard(length: number): void;
18
+ }
@@ -10,9 +10,15 @@
10
10
  * - Safari >= 14.1
11
11
  * - Edge >= 89
12
12
  */
13
- import { type CompressOptions, hasCompressionStream } from "./compress.base.js";
13
+ import { type CompressOptions } from "./compress.base.js";
14
14
  export { type CompressOptions };
15
- export { hasCompressionStream };
15
+ /**
16
+ * Check if CompressionStream is available in this environment.
17
+ *
18
+ * Note: Some environments may expose CompressionStream but not support
19
+ * the "deflate-raw" format that ZIP requires.
20
+ */
21
+ export declare function hasCompressionStream(): boolean;
16
22
  /**
17
23
  * Compress data using browser's native CompressionStream or JS fallback
18
24
  *
@@ -1,5 +1,4 @@
1
1
  import type { ZipTimestampMode } from "./utils/timestamps.js";
2
- export declare const DEFAULT_DEFLATE_LEVEL = 6;
3
2
  export declare const DEFAULT_COMPRESS_LEVEL = 6;
4
3
  export declare const DEFAULT_ZIP_LEVEL = 6;
5
4
  export declare const DEFAULT_ZIP_TIMESTAMPS: ZipTimestampMode;
@@ -5,7 +5,7 @@
5
5
  * Platform-specific entrypoints (index.ts / index.browser.ts) should re-export
6
6
  * from this file and then layer their platform-specific bindings.
7
7
  */
8
- export type { ArchiveSource } from "./io/archive-source.js";
9
- export type { ArchiveSink } from "./io/archive-sink.js";
10
- export { zip, ZipArchive, type ZipOptions, type ZipEntryOptions } from "./zip/index.js";
11
- export { unzip, ZipReader, UnzipEntry, type UnzipOptions } from "./unzip/index.js";
8
+ export { createZip, createZipSync, ZipBuilder, type ZipEntry, type ZipOptions } from "./zip-builder.js";
9
+ export { StreamingZip, ZipDeflateFile, Zip, ZipDeflate } from "./streaming-zip.js";
10
+ export { extractAll, extractFile, listFiles, forEachEntry, ZipParser, type ExtractedFile, type ZipParseOptions } from "./extract.js";
11
+ export type { ZipEntryInfo } from "./zip-entry-info.js";
@@ -5,6 +5,7 @@
5
5
  * browser-specific implementations so we can enforce export-surface parity.
6
6
  */
7
7
  export * from "./index.base.js";
8
- export { crc32, crc32Update, crc32Finalize } from "./compression/crc32.browser.js";
9
- export { compress, compressSync, decompress, decompressSync, hasCompressionStream, type CompressOptions } from "./compression/compress.browser.js";
10
- export { createDeflateStream, createInflateStream, hasDeflateRaw, type StreamCompressOptions } from "./compression/streaming-compress.browser.js";
8
+ export { crc32, crc32Update, crc32Finalize } from "./crc32.browser.js";
9
+ export { compress, compressSync, decompress, decompressSync, hasCompressionStream, type CompressOptions } from "./compress.browser.js";
10
+ export { createDeflateStream, createInflateStream, hasDeflateRaw, type StreamCompressOptions } from "./streaming-compress.browser.js";
11
+ export { Parse, createParse, type ParseOptions, type ZipEntry as StreamZipEntry } from "./parse.browser.js";
@@ -5,6 +5,7 @@
5
5
  * It groups all ZIP creation and extraction utilities in one place.
6
6
  */
7
7
  export * from "./index.base.js";
8
- export { crc32, crc32Update, crc32Finalize } from "./compression/crc32.js";
9
- export { compress, compressSync, decompress, decompressSync, hasCompressionStream, type CompressOptions } from "./compression/compress.js";
10
- export { createDeflateStream, createInflateStream, hasDeflateRaw, type StreamCompressOptions } from "./compression/streaming-compress.js";
8
+ export { crc32, crc32Update, crc32Finalize } from "./crc32.js";
9
+ export { compress, compressSync, decompress, decompressSync, hasCompressionStream, type CompressOptions } from "./compress.js";
10
+ export { createDeflateStream, createInflateStream, hasDeflateRaw, type StreamCompressOptions } from "./streaming-compress.js";
11
+ export { Parse, createParse, type ParseOptions, type ZipEntry as StreamZipEntry } from "./parse.js";
@@ -1,7 +1,6 @@
1
- import { Duplex, PassThrough, Transform, type Readable } from "../../stream/index.js";
2
- import { ByteQueue } from "../internal/byte-queue.js";
3
- import { parseZipExtraFields, type ZipExtraFields, type ZipVars } from "../utils/zip-extra-fields.js";
4
- export declare const DATA_DESCRIPTOR_SIGNATURE_BYTES: Uint8Array<ArrayBufferLike>;
1
+ import { Duplex, PassThrough, Transform, type Readable } from "../stream/index.js";
2
+ import { ByteQueue } from "./byte-queue.js";
3
+ import { parseZipExtraFields, type ZipExtraFields, type ZipVars } from "./utils/zip-extra-fields.js";
5
4
  export declare const CRX_HEADER_FORMAT: [string, number][];
6
5
  export declare const LOCAL_FILE_HEADER_FORMAT: [string, number][];
7
6
  export declare const DATA_DESCRIPTOR_FORMAT: [string, number][];
@@ -120,14 +119,9 @@ export interface ValidatedDataDescriptorScanResult {
120
119
  */
121
120
  export declare function scanValidatedDataDescriptor(view: Uint8Array, dataDescriptorSignature: Uint8Array, bytesEmitted: number, startIndex?: number, out?: ValidatedDataDescriptorScanResult): ValidatedDataDescriptorScanResult;
122
121
  export interface StreamUntilValidatedDataDescriptorSource {
122
+ getView(): Uint8Array;
123
123
  getLength(): number;
124
124
  read(length: number): Uint8Array;
125
- /** Optional: zero-copy chunk views for streaming writes. */
126
- peekChunks?(length: number): Uint8Array[];
127
- /** Optional: consume bytes previously written from peekChunks(). */
128
- discard?(length: number): void;
129
- indexOfPattern(pattern: Uint8Array, startIndex: number): number;
130
- peekUint32LE(offset: number): number | null;
131
125
  isFinished(): boolean;
132
126
  onDataAvailable(cb: () => void): () => void;
133
127
  maybeReleaseWriteCallback?: () => void;
@@ -148,34 +142,6 @@ export declare function streamUntilValidatedDataDescriptor(options: StreamUntilV
148
142
  export interface ParseOptions {
149
143
  verbose?: boolean;
150
144
  forceStream?: boolean;
151
- /**
152
- * Browser-only: use a Web Worker to run inflate off the main thread.
153
- * Defaults to false.
154
- */
155
- useWorkerInflate?: boolean;
156
- /**
157
- * Browser-only: provide an explicit Worker script URL.
158
- *
159
- * Useful under strict CSP that blocks `blob:` workers. When set, the browser
160
- * parser will try to construct `new Worker(workerInflateUrl)`.
161
- */
162
- workerInflateUrl?: string;
163
- /**
164
- * Input backpressure high-water mark (bytes).
165
- *
166
- * When provided, implementations may delay the writable callback until the
167
- * internal input buffer drops below `inputLowWaterMarkBytes`.
168
- *
169
- * This is primarily used by the browser parser, because its writable side
170
- * otherwise tends to accept unlimited data and can cause large memory spikes.
171
- */
172
- inputHighWaterMarkBytes?: number;
173
- /**
174
- * Input backpressure low-water mark (bytes).
175
- * When the internal buffer drops to (or below) this value, a delayed writable
176
- * callback may be released.
177
- */
178
- inputLowWaterMarkBytes?: number;
179
145
  /**
180
146
  * Threshold (in bytes) for small file optimization.
181
147
  * Files smaller than this will use sync decompression (no stream overhead).
@@ -5,8 +5,8 @@
5
5
  * Falls back to pure JavaScript implementation for older browsers.
6
6
  * Uses the browser Duplex stream implementation for compatibility.
7
7
  */
8
- import { Duplex } from "../../stream/index.js";
9
- import { type CrxHeader, type PullStreamPublicApi, type EntryProps, type EntryVars, type InflateFactory, type ParseOptions, type ZipEntry } from "./stream.base.js";
8
+ import { Duplex } from "../stream/index.js";
9
+ import { type CrxHeader, type PullStreamPublicApi, type EntryProps, type EntryVars, type InflateFactory, type ParseOptions, type ZipEntry } from "./parse.base.js";
10
10
  export type { CrxHeader, EntryProps, EntryVars, ParseOptions, ZipEntry };
11
11
  export type ParseStream = Duplex & {
12
12
  promise(): Promise<void>;
@@ -1,6 +1,6 @@
1
- import type { Duplex } from "../../stream/index.js";
2
- import { type PullStreamPublicApi, type CrxHeader, type EntryProps, type EntryVars, type InflateFactory, type ParseOptions, type ZipEntry } from "./stream.base.js";
3
- export type { CrxHeader } from "./stream.base.js";
1
+ import type { Duplex } from "../stream/index.js";
2
+ import { type PullStreamPublicApi, type CrxHeader, type EntryProps, type EntryVars, type InflateFactory, type ParseOptions, type ZipEntry } from "./parse.base.js";
3
+ export type { CrxHeader } from "./parse.base.js";
4
4
  export type { EntryProps, EntryVars, ParseOptions, ZipEntry };
5
5
  export type ParseStream = Duplex & {
6
6
  promise(): Promise<void>;
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * API compatible with Node.js version - supports .on("data"), .on("end"), .write(callback), .end()
8
8
  */
9
- export type { DeflateStream, InflateStream, StreamCompressOptions, StreamingCodec } from "./streaming-compress.base.js";
9
+ export type { StreamCompressOptions } from "./streaming-compress.base.js";
10
10
  import { type DeflateStream, type InflateStream, type StreamCompressOptions } from "./streaming-compress.base.js";
11
11
  /**
12
12
  * Check if deflate-raw streaming compression is supported by this library.
@@ -2,18 +2,17 @@
2
2
  * True Streaming ZIP creator - shared implementation.
3
3
  *
4
4
  * This module is intentionally platform-agnostic.
5
- * - In Node builds it uses `./compression/crc32` + `./compression/streaming-compress` (zlib-backed).
5
+ * - In Node builds it uses `./crc32` + `./streaming-compress` (zlib-backed).
6
6
  * - In browser builds the bundler aliases those imports to their browser variants.
7
7
  */
8
- import type { ZipTimestampMode } from "../utils/timestamps.js";
9
- import type { ZipEntryInfo as UnzipZipEntryInfo } from "../zip-spec/zip-entry-info.js";
8
+ import type { ZipTimestampMode } from "./utils/timestamps.js";
9
+ import type { ZipEntryInfo as UnzipZipEntryInfo } from "./zip-entry-info.js";
10
10
  /**
11
11
  * Internal entry info for central directory
12
12
  */
13
13
  interface ZipEntryInfo {
14
14
  name: Uint8Array;
15
15
  extraField: Uint8Array;
16
- comment: Uint8Array;
17
16
  flags: number;
18
17
  crc: number;
19
18
  compressedSize: number;
@@ -35,62 +34,43 @@ export declare class ZipDeflateFile {
35
34
  private _finalized;
36
35
  private _headerEmitted;
37
36
  private _ondata;
38
- private _onerror;
39
37
  private _centralDirEntryInfo;
40
38
  private _pendingEnd;
41
39
  private _emittedDataDescriptor;
42
40
  private _localHeader;
43
- private _deflateWanted;
44
- private _pendingChunks;
45
- private _sampleBuffer;
46
- private _sampleLen;
47
- private _smartStore;
48
41
  private _completeResolve;
49
42
  private _completeReject;
50
43
  private _completePromise;
51
44
  private _completeError;
52
45
  private _dataQueue;
53
46
  private _finalQueued;
54
- private _pushChain;
55
47
  readonly name: string;
56
48
  readonly level: number;
57
49
  readonly nameBytes: Uint8Array;
58
- readonly commentBytes: Uint8Array;
59
50
  readonly dosTime: number;
60
51
  readonly dosDate: number;
61
52
  readonly extraField: Uint8Array;
62
53
  private readonly _flags;
63
- private _compressionMethod;
54
+ private readonly _compressionMethod;
64
55
  private readonly _modTime;
65
56
  constructor(name: string, options?: {
66
57
  level?: number;
67
58
  modTime?: Date;
68
59
  timestamps?: ZipTimestampMode;
69
- comment?: string;
70
- smartStore?: boolean;
71
60
  });
72
- private _buildCompressionMethod;
73
- private _initDeflateStream;
74
61
  private _buildLocalHeader;
75
- private _accumulateSample;
76
- private _shouldDecide;
77
- private _decideCompressionIfNeeded;
78
- private _emitHeaderIfNeeded;
79
- private _flushPendingChunks;
80
62
  private _enqueueData;
81
63
  private _flushQueue;
82
64
  get ondata(): ((data: Uint8Array, final: boolean) => void) | undefined;
83
65
  set ondata(cb: (data: Uint8Array, final: boolean) => void);
84
- get onerror(): ((err: Error) => void) | undefined;
85
- set onerror(cb: (err: Error) => void);
86
66
  private _resolveComplete;
87
67
  private _rejectComplete;
88
68
  private _ensureCompletePromise;
89
69
  private _tapCallback;
70
+ private _emitHeaderIfNeeded;
90
71
  private _writeData;
91
72
  private _endDeflateAndWait;
92
73
  private _finalizeAfterWrite;
93
- private _pushUnchained;
94
74
  /**
95
75
  * Push data - immediately compresses and outputs
96
76
  * Returns a Promise that resolves when the write is complete.
@@ -128,13 +108,10 @@ export declare class StreamingZip {
128
108
  private currentOffset;
129
109
  private ended;
130
110
  private endPending;
131
- private zipComment;
132
111
  private fileQueue;
133
112
  private fileQueueIndex;
134
113
  private activeFile;
135
- constructor(callback: (err: Error | null, data: Uint8Array, final: boolean) => void, options?: {
136
- comment?: string;
137
- });
114
+ constructor(callback: (err: Error | null, data: Uint8Array, final: boolean) => void);
138
115
  add(file: ZipDeflateFile): void;
139
116
  private _processNextFile;
140
117
  private _finalize;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * ZIP extra field parsing helpers.
3
3
  *
4
- * Kept standalone so both streaming parser (`stream.base.ts`) and buffer parser
4
+ * Kept standalone so both streaming parser (`parse.base.ts`) and buffer parser
5
5
  * (`zip-parser.ts`) can share ZIP64 + Info-ZIP timestamp handling.
6
6
  */
7
7
  export interface ZipVars {
@@ -0,0 +1,18 @@
1
+ export declare function unixSecondsFromDate(date: Date): number;
2
+ /**
3
+ * Build Info-ZIP "Extended Timestamp" extra field (0x5455).
4
+ * We write only mtime (UTC, Unix seconds) to minimize size.
5
+ *
6
+ * Layout:
7
+ * - Header ID: 2 bytes (0x5455)
8
+ * - Data size: 2 bytes
9
+ * - Flags: 1 byte (bit0 = mtime)
10
+ * - mtime: 4 bytes (Unix seconds)
11
+ */
12
+ export declare function buildExtendedTimestampExtraFieldFromUnixSeconds(unixSeconds: number): Uint8Array;
13
+ export declare function buildExtendedTimestampExtraFieldFromDate(date: Date): Uint8Array;
14
+ /**
15
+ * Parse Info-ZIP "Extended Timestamp" extra field (0x5455) and return mtime.
16
+ * Returns Unix seconds (UTC) if present.
17
+ */
18
+ export declare function parseExtendedTimestampMtimeUnixSeconds(extraField: Uint8Array): number | undefined;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * ZIP file format builder
3
+ *
4
+ * Implements ZIP file structure according to PKWARE's APPNOTE.TXT specification
5
+ * https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
6
+ *
7
+ * ZIP file structure:
8
+ * ┌──────────────────────────┐
9
+ * │ Local File Header 1 │
10
+ * │ File Data 1 │
11
+ * ├──────────────────────────┤
12
+ * │ Local File Header 2 │
13
+ * │ File Data 2 │
14
+ * ├──────────────────────────┤
15
+ * │ ... │
16
+ * ├──────────────────────────┤
17
+ * │ Central Directory 1 │
18
+ * │ Central Directory 2 │
19
+ * │ ... │
20
+ * ├──────────────────────────┤
21
+ * │ End of Central Directory │
22
+ * └──────────────────────────┘
23
+ */
24
+ import { type CompressOptions } from "./compress.js";
25
+ import { type ZipTimestampMode } from "./utils/timestamps.js";
26
+ /**
27
+ * ZIP file entry
28
+ */
29
+ export interface ZipEntry {
30
+ /** File name (can include directory path, use forward slashes) */
31
+ name: string;
32
+ /** File data (will be compressed unless level=0) */
33
+ data: Uint8Array;
34
+ /** File modification time (optional, defaults to current time) */
35
+ modTime?: Date;
36
+ /** File comment (optional) */
37
+ comment?: string;
38
+ }
39
+ /**
40
+ * ZIP builder options
41
+ */
42
+ export interface ZipOptions extends CompressOptions {
43
+ /** ZIP file comment (optional) */
44
+ comment?: string;
45
+ /**
46
+ * Timestamp writing strategy.
47
+ * - "dos": only write DOS date/time fields (smallest output)
48
+ * - "dos+utc": also write UTC mtime in 0x5455 extra field (default, best practice)
49
+ */
50
+ timestamps?: ZipTimestampMode;
51
+ }
52
+ /**
53
+ * Create a ZIP file from entries (async)
54
+ *
55
+ * @param entries - Files to include in ZIP
56
+ * @param options - ZIP options
57
+ * @returns ZIP file as Uint8Array
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const zip = await createZip([
62
+ * { name: "hello.txt", data: new TextEncoder().encode("Hello!") },
63
+ * { name: "folder/file.txt", data: new TextEncoder().encode("Nested!") }
64
+ * ], { level: 6 });
65
+ * ```
66
+ */
67
+ export declare function createZip(entries: ZipEntry[], options?: ZipOptions): Promise<Uint8Array>;
68
+ /**
69
+ * Create a ZIP file from entries (sync)
70
+ *
71
+ * This is supported in both Node.js and browser builds.
72
+ */
73
+ export declare function createZipSync(entries: ZipEntry[], options?: ZipOptions): Uint8Array;
74
+ /**
75
+ * Streaming ZIP builder for large files
76
+ * Writes chunks to a callback as they are generated
77
+ */
78
+ export declare class ZipBuilder {
79
+ private entries;
80
+ private currentOffset;
81
+ private level;
82
+ private zipComment;
83
+ private timestamps;
84
+ private compressOptions;
85
+ private settings;
86
+ private finalized;
87
+ /**
88
+ * Create a new ZIP builder
89
+ * @param options - ZIP options
90
+ */
91
+ constructor(options?: ZipOptions);
92
+ /**
93
+ * Add a file to the ZIP (async)
94
+ * @param entry - File entry
95
+ * @returns Local file header and compressed data chunks
96
+ */
97
+ addFile(entry: ZipEntry): Promise<Uint8Array[]>;
98
+ /**
99
+ * Add a file to the ZIP (sync)
100
+ * @param entry - File entry
101
+ * @returns Local file header and compressed data chunks
102
+ */
103
+ addFileSync(entry: ZipEntry): Uint8Array[];
104
+ /**
105
+ * Finalize the ZIP and return central directory + end record
106
+ * @returns Central directory and end of central directory chunks
107
+ */
108
+ finalize(): Uint8Array[];
109
+ /**
110
+ * Get current number of entries
111
+ */
112
+ get entryCount(): number;
113
+ /**
114
+ * Get current ZIP data size (without central directory)
115
+ */
116
+ get dataSize(): number;
117
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ZIP format constants (PKWARE APPNOTE)
3
+ * Shared by ZIP writer and parser implementations.
4
+ */
5
+ export declare const LOCAL_FILE_HEADER_SIG = 67324752;
6
+ export declare const CENTRAL_DIR_HEADER_SIG = 33639248;
7
+ export declare const END_OF_CENTRAL_DIR_SIG = 101010256;
8
+ export declare const DATA_DESCRIPTOR_SIG = 134695760;
9
+ export declare const ZIP64_END_OF_CENTRAL_DIR_SIG = 101075792;
10
+ export declare const ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIG = 117853008;
11
+ export declare const VERSION_NEEDED = 20;
12
+ export declare const VERSION_MADE_BY = 20;
13
+ export declare const COMPRESSION_STORE = 0;
14
+ export declare const COMPRESSION_DEFLATE = 8;
15
+ export declare const FLAG_UTF8 = 2048;
16
+ export declare const FLAG_DATA_DESCRIPTOR = 8;
17
+ export declare const UINT16_MAX = 65535;
18
+ export declare const UINT32_MAX = 4294967295;
@@ -1,4 +1,4 @@
1
- import { type ZipTimestampMode } from "../utils/timestamps.js";
1
+ import { type ZipTimestampMode } from "./utils/timestamps.js";
2
2
  export interface ZipEntryMetadata {
3
3
  nameBytes: Uint8Array;
4
4
  commentBytes: Uint8Array;
@@ -3,7 +3,7 @@
3
3
  * Works in both Node.js and browser environments
4
4
  * No dependency on Node.js stream module
5
5
  */
6
- import type { ZipEntryInfo } from "@archive/zip-spec/zip-entry-info";
6
+ import type { ZipEntryInfo } from "./zip-entry-info.js";
7
7
  export type { ZipEntryInfo };
8
8
  /**
9
9
  * ZIP parsing options
@@ -3,23 +3,6 @@
3
3
  *
4
4
  * Shared by streaming zip writer and buffer zip builder.
5
5
  */
6
- export declare const LOCAL_FILE_HEADER_SIG = 67324752;
7
- export declare const CENTRAL_DIR_HEADER_SIG = 33639248;
8
- export declare const END_OF_CENTRAL_DIR_SIG = 101010256;
9
- export declare const DATA_DESCRIPTOR_SIG = 134695760;
10
- export declare const ZIP64_END_OF_CENTRAL_DIR_SIG = 101075792;
11
- export declare const ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIG = 117853008;
12
- export declare const VERSION_NEEDED = 20;
13
- export declare const VERSION_MADE_BY = 20;
14
- export declare const COMPRESSION_STORE = 0;
15
- export declare const COMPRESSION_DEFLATE = 8;
16
- export declare const FLAG_UTF8 = 2048;
17
- export declare const FLAG_DATA_DESCRIPTOR = 8;
18
- export declare const UINT16_MAX = 65535;
19
- export declare const UINT32_MAX = 4294967295;
20
- export declare const ZIP_LOCAL_FILE_HEADER_FIXED_SIZE = 30;
21
- export declare const ZIP_CENTRAL_DIR_HEADER_FIXED_SIZE = 46;
22
- export declare const ZIP_END_OF_CENTRAL_DIR_FIXED_SIZE = 22;
23
6
  export interface ZipLocalFileHeaderInput {
24
7
  fileName: Uint8Array;
25
8
  extraField: Uint8Array;
@@ -32,7 +15,6 @@ export interface ZipLocalFileHeaderInput {
32
15
  uncompressedSize: number;
33
16
  versionNeeded?: number;
34
17
  }
35
- export declare function writeLocalFileHeaderInto(out: Uint8Array, view: DataView, offset: number, input: ZipLocalFileHeaderInput): number;
36
18
  export declare function buildLocalFileHeader(input: ZipLocalFileHeaderInput): Uint8Array;
37
19
  export interface ZipCentralDirectoryHeaderInput {
38
20
  fileName: Uint8Array;
@@ -50,7 +32,6 @@ export interface ZipCentralDirectoryHeaderInput {
50
32
  versionNeeded?: number;
51
33
  externalAttributes?: number;
52
34
  }
53
- export declare function writeCentralDirectoryHeaderInto(out: Uint8Array, view: DataView, offset: number, input: ZipCentralDirectoryHeaderInput): number;
54
35
  export declare function buildCentralDirectoryHeader(input: ZipCentralDirectoryHeaderInput): Uint8Array;
55
36
  export interface ZipEndOfCentralDirectoryInput {
56
37
  entryCount: number;
@@ -58,6 +39,5 @@ export interface ZipEndOfCentralDirectoryInput {
58
39
  centralDirOffset: number;
59
40
  comment: Uint8Array;
60
41
  }
61
- export declare function writeEndOfCentralDirectoryInto(out: Uint8Array, view: DataView, offset: number, input: ZipEndOfCentralDirectoryInput): number;
62
42
  export declare function buildEndOfCentralDirectory(input: ZipEndOfCentralDirectoryInput): Uint8Array;
63
43
  export declare function buildDataDescriptor(crc32: number, compressedSize: number, uncompressedSize: number): Uint8Array<ArrayBuffer>;
@@ -7,7 +7,7 @@
7
7
  * Node.js uses `workbook-writer.ts`, which extends the same base implementation
8
8
  * with filesystem-specific features (filename output + image loading).
9
9
  */
10
- import { Zip } from "../../archive/zip/stream.js";
10
+ import { Zip } from "../../archive/streaming-zip.js";
11
11
  import { StreamBuf } from "../utils/stream-buf.js";
12
12
  import { StylesXform } from "../xlsx/xform/style/styles-xform.js";
13
13
  import { SharedStrings } from "../utils/shared-strings.js";