@zip.js/zip.js 2.8.44 → 2.8.45

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 (51) hide show
  1. package/deno.json +21 -1
  2. package/dist/zip-core-external.js +138 -123
  3. package/dist/zip-core-external.min.js +1 -1
  4. package/dist/zip-core.js +137 -96
  5. package/dist/zip-core.min.js +1 -1
  6. package/dist/zip-fs-core-external.js +190 -131
  7. package/dist/zip-fs-core-external.min.js +1 -1
  8. package/dist/zip-fs-core.js +189 -104
  9. package/dist/zip-fs-core.min.js +1 -1
  10. package/dist/zip-fs-external.js +211 -1725
  11. package/dist/zip-fs-external.min.js +1 -1
  12. package/dist/zip-fs-native.js +212 -1700
  13. package/dist/zip-fs-native.min.js +1 -1
  14. package/dist/zip-fs.js +211 -1699
  15. package/dist/zip-fs.min.js +1 -1
  16. package/dist/zip-legacy.js +139 -98
  17. package/dist/zip-legacy.min.js +1 -1
  18. package/dist/zip-native.js +139 -98
  19. package/dist/zip-native.min.js +1 -1
  20. package/dist/zip-web-worker-native.js +1 -1
  21. package/dist/zip-web-worker.js +1 -1
  22. package/dist/zip.js +138 -97
  23. package/dist/zip.min.js +1 -1
  24. package/eslint.config.mjs +31 -2
  25. package/index-native.cjs +212 -1700
  26. package/index-native.min.js +1 -1
  27. package/index.cjs +211 -1699
  28. package/index.d.cts +49 -1
  29. package/index.d.ts +49 -1
  30. package/index.min.js +1 -1
  31. package/lib/core/codec-worker.js +2 -2
  32. package/lib/core/constants.js +4 -0
  33. package/lib/core/options.js +2 -0
  34. package/lib/core/streams/aes-crypto-stream.js +15 -18
  35. package/lib/core/streams/codec-stream.js +2 -2
  36. package/lib/core/streams/zip-entry-stream.js +5 -10
  37. package/lib/core/util/mime-type-data.js +3 -0
  38. package/lib/core/util/mime-type.js +23 -1596
  39. package/lib/core/web-worker-base.js +2 -2
  40. package/lib/core/web-worker-inline-native.js +1 -1
  41. package/lib/core/web-worker-inline-wasm.js +1 -1
  42. package/lib/core/zip-entry.js +8 -1
  43. package/lib/core/zip-fs.js +62 -5
  44. package/lib/core/zip-reader.js +45 -17
  45. package/lib/core/zip-writer.js +58 -44
  46. package/lib/zip-core-external.js +2 -0
  47. package/lib/zip-fs-core-external.js +2 -0
  48. package/lib/zip-fs-external.js +2 -0
  49. package/lib/zip-mime-types.js +2 -0
  50. package/package.json +9 -3
  51. package/worker-message-property-names.js +1 -1
package/index.d.cts CHANGED
@@ -1292,6 +1292,30 @@ export interface EntryExtraFieldAES extends EntryExtraField {
1292
1292
  */
1293
1293
  originalCompressionMethod?: number;
1294
1294
  }
1295
+ /**
1296
+ * Represents a Unix extra field record storing timestamps: the Info-ZIP Unix type 1 extra field (0x5855),
1297
+ * written notably by macOS Archive Utility and `ditto`, or the PKWARE Unix extra field (0x000d). Both store
1298
+ * the last access/modification dates as 32-bit Unix times, followed by the optional uid/gid in the local
1299
+ * file header.
1300
+ */
1301
+ export interface EntryExtraFieldUnixDates extends EntryExtraField {
1302
+ /**
1303
+ * The last access date.
1304
+ */
1305
+ lastAccessDate?: Date;
1306
+ /**
1307
+ * The last modification date.
1308
+ */
1309
+ lastModDate?: Date;
1310
+ /**
1311
+ * The Unix user id.
1312
+ */
1313
+ uid?: number;
1314
+ /**
1315
+ * The Unix group id.
1316
+ */
1317
+ gid?: number;
1318
+ }
1295
1319
  /**
1296
1320
  * Represents a Unicode path or comment extra field record of an entry.
1297
1321
  */
@@ -1387,6 +1411,14 @@ export interface LocalDirectory {
1387
1411
  * The Info-ZIP Unix extra field.
1388
1412
  */
1389
1413
  extraFieldInfoZip?: EntryExtraField;
1414
+ /**
1415
+ * The Info-ZIP Unix type 1 extra field (0x5855).
1416
+ */
1417
+ extraFieldUnixType1?: EntryExtraFieldUnixDates;
1418
+ /**
1419
+ * The PKWARE Unix extra field (0x000d).
1420
+ */
1421
+ extraFieldPkwareUnix?: EntryExtraFieldUnixDates;
1390
1422
  /**
1391
1423
  * The extended timestamp extra field.
1392
1424
  */
@@ -1660,6 +1692,14 @@ export interface EntryMetaData {
1660
1692
  * The Info-ZIP Unix extra field.
1661
1693
  */
1662
1694
  extraFieldInfoZip?: EntryExtraField;
1695
+ /**
1696
+ * The Info-ZIP Unix type 1 extra field (0x5855).
1697
+ */
1698
+ extraFieldUnixType1?: EntryExtraFieldUnixDates;
1699
+ /**
1700
+ * The PKWARE Unix extra field (0x000d).
1701
+ */
1702
+ extraFieldPkwareUnix?: EntryExtraFieldUnixDates;
1663
1703
  /**
1664
1704
  * The extended timestamp extra field.
1665
1705
  */
@@ -1968,15 +2008,23 @@ export interface ZipWriterAddDataOptions
1968
2008
  */
1969
2009
  comment?: string;
1970
2010
  /**
1971
- * The extra field of the entry.
2011
+ * The extra field of the entry, written in the local file header and the central directory.
1972
2012
  */
1973
2013
  extraField?: Map<number, Uint8Array>;
2014
+ /**
2015
+ * The extra field of the entry written only in the local file header.
2016
+ */
2017
+ localExtraField?: Map<number, Uint8Array>;
1974
2018
  /**
1975
2019
  * The uncompressed size of the entry. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
1976
2020
  */
1977
2021
  uncompressedSize?: number;
1978
2022
  /**
1979
2023
  * The CRC-32 checksum of the content. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
2024
+ *
2025
+ * When the entry is AES-encrypted (see {@link ZipWriterConstructorOptions#encrypted}), setting this option marks the entry as AE-1
2026
+ * and stores the checksum in the entry headers, e.g. when copying an AE-1 entry read with the
2027
+ * {@link ZipReaderOptions#passThrough} option. Otherwise, the entry is marked as AE-2 and the checksum fields are set to 0.
1980
2028
  */
1981
2029
  crc32?: number;
1982
2030
  /**
package/index.d.ts CHANGED
@@ -1292,6 +1292,30 @@ export interface EntryExtraFieldAES extends EntryExtraField {
1292
1292
  */
1293
1293
  originalCompressionMethod?: number;
1294
1294
  }
1295
+ /**
1296
+ * Represents a Unix extra field record storing timestamps: the Info-ZIP Unix type 1 extra field (0x5855),
1297
+ * written notably by macOS Archive Utility and `ditto`, or the PKWARE Unix extra field (0x000d). Both store
1298
+ * the last access/modification dates as 32-bit Unix times, followed by the optional uid/gid in the local
1299
+ * file header.
1300
+ */
1301
+ export interface EntryExtraFieldUnixDates extends EntryExtraField {
1302
+ /**
1303
+ * The last access date.
1304
+ */
1305
+ lastAccessDate?: Date;
1306
+ /**
1307
+ * The last modification date.
1308
+ */
1309
+ lastModDate?: Date;
1310
+ /**
1311
+ * The Unix user id.
1312
+ */
1313
+ uid?: number;
1314
+ /**
1315
+ * The Unix group id.
1316
+ */
1317
+ gid?: number;
1318
+ }
1295
1319
  /**
1296
1320
  * Represents a Unicode path or comment extra field record of an entry.
1297
1321
  */
@@ -1387,6 +1411,14 @@ export interface LocalDirectory {
1387
1411
  * The Info-ZIP Unix extra field.
1388
1412
  */
1389
1413
  extraFieldInfoZip?: EntryExtraField;
1414
+ /**
1415
+ * The Info-ZIP Unix type 1 extra field (0x5855).
1416
+ */
1417
+ extraFieldUnixType1?: EntryExtraFieldUnixDates;
1418
+ /**
1419
+ * The PKWARE Unix extra field (0x000d).
1420
+ */
1421
+ extraFieldPkwareUnix?: EntryExtraFieldUnixDates;
1390
1422
  /**
1391
1423
  * The extended timestamp extra field.
1392
1424
  */
@@ -1660,6 +1692,14 @@ export interface EntryMetaData {
1660
1692
  * The Info-ZIP Unix extra field.
1661
1693
  */
1662
1694
  extraFieldInfoZip?: EntryExtraField;
1695
+ /**
1696
+ * The Info-ZIP Unix type 1 extra field (0x5855).
1697
+ */
1698
+ extraFieldUnixType1?: EntryExtraFieldUnixDates;
1699
+ /**
1700
+ * The PKWARE Unix extra field (0x000d).
1701
+ */
1702
+ extraFieldPkwareUnix?: EntryExtraFieldUnixDates;
1663
1703
  /**
1664
1704
  * The extended timestamp extra field.
1665
1705
  */
@@ -1968,15 +2008,23 @@ export interface ZipWriterAddDataOptions
1968
2008
  */
1969
2009
  comment?: string;
1970
2010
  /**
1971
- * The extra field of the entry.
2011
+ * The extra field of the entry, written in the local file header and the central directory.
1972
2012
  */
1973
2013
  extraField?: Map<number, Uint8Array>;
2014
+ /**
2015
+ * The extra field of the entry written only in the local file header.
2016
+ */
2017
+ localExtraField?: Map<number, Uint8Array>;
1974
2018
  /**
1975
2019
  * The uncompressed size of the entry. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
1976
2020
  */
1977
2021
  uncompressedSize?: number;
1978
2022
  /**
1979
2023
  * The CRC-32 checksum of the content. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
2024
+ *
2025
+ * When the entry is AES-encrypted (see {@link ZipWriterConstructorOptions#encrypted}), setting this option marks the entry as AE-1
2026
+ * and stores the checksum in the entry headers, e.g. when copying an AE-1 entry read with the
2027
+ * {@link ZipReaderOptions#passThrough} option. Otherwise, the entry is marked as AE-2 and the checksum fields are set to 0.
1980
2028
  */
1981
2029
  crc32?: number;
1982
2030
  /**