@zip.js/zip.js 2.8.52 → 2.8.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -272,7 +272,7 @@ export interface Configuration extends WorkerConfiguration {
272
272
  /**
273
273
  * The maximum number of web workers used to compress/decompress data simultaneously.
274
274
  *
275
- * @defaultValue `navigator.hardwareConcurrency`
275
+ * @defaultValue `navigator.hardwareConcurrency`, or 2 when the environment does not provide it
276
276
  */
277
277
  maxWorkers?: number;
278
278
  /**
@@ -311,7 +311,7 @@ export interface Configuration extends WorkerConfiguration {
311
311
  * });
312
312
  * ```
313
313
  *
314
- * @defaultValue "./core/web-worker.js"
314
+ * @defaultValue "./core/web-worker-wasm.js", or "./core/web-worker-native.js" for the builds using the native implementations
315
315
  */
316
316
  workerURI?: string;
317
317
  /**
@@ -351,25 +351,25 @@ export interface Configuration extends WorkerConfiguration {
351
351
  /**
352
352
  * The stream implementation used to compress data when `useCompressionStream` is set to `true`.
353
353
  *
354
- * @defaultValue {@link CodecStream}
354
+ * @defaultValue the global `CompressionStream`, or `false` when the environment does not provide it
355
355
  */
356
356
  CompressionStream?: typeof TransformStreamLike;
357
357
  /**
358
358
  * The stream implementation used to decompress data when `useCompressionStream` is set to `true`.
359
359
  *
360
- * @defaultValue {@link CodecStream}
360
+ * @defaultValue the global `DecompressionStream`, or `false` when the environment does not provide it
361
361
  */
362
362
  DecompressionStream?: typeof TransformStreamLike;
363
363
  /**
364
364
  * The stream implementation used to compress data when `useCompressionStream` is set to `false`.
365
365
  *
366
- * @defaultValue {@link CodecStream}
366
+ * @defaultValue the implementation embedded in the entry point that was imported, e.g. the WebAssembly one
367
367
  */
368
368
  CompressionStreamFallback?: typeof TransformStreamLike;
369
369
  /**
370
370
  * The stream implementation used to decompress data when `useCompressionStream` is set to `false`.
371
371
  *
372
- * @defaultValue {@link CodecStream}
372
+ * @defaultValue the implementation embedded in the entry point that was imported, e.g. the WebAssembly one
373
373
  */
374
374
  DecompressionStreamFallback?: typeof TransformStreamLike;
375
375
  /**
@@ -724,7 +724,11 @@ export class Data64URIReader extends Reader<string> {}
724
724
  export class Uint8ArrayReader extends Reader<Uint8Array> {}
725
725
 
726
726
  /**
727
- * Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
727
+ * Represents a {@link Reader} instance used to read data provided as an array of {@link Reader} instances,
728
+ * {@link ReadableReader} instances or `ReadableStream` instances (e.g. split zip files).
729
+ *
730
+ * @remarks Elements that only provide a `ReadableStream` are buffered when the reader is initialized, since
731
+ * mapping a global offset onto a disk requires the size of every disk.
728
732
  */
729
733
  export class SplitDataReader extends Reader<
730
734
  Reader<unknown>[] | ReadableReader[] | ReadableStream[]
@@ -783,7 +787,11 @@ export interface HttpOptions extends HttpRangeOptions {
783
787
  * `true` to prevent using `HEAD` HTTP request in order the get the size of the content.
784
788
  * `false` to explicitly use `HEAD`, this is useful in case of CORS where `Access-Control-Expose-Headers: Content-Range` is not returned by the server.
785
789
  *
786
- * @defaultValue false
790
+ * Leaving it unset is not the same as setting it to `false` when {@link HttpOptions#useRangeHeader} or
791
+ * {@link HttpOptions#forceRangeRequests} is set: the size is then read from a ranged `GET` request instead, and
792
+ * only an explicit `false` restores the `HEAD` request.
793
+ *
794
+ * @defaultValue false, and `true` when {@link HttpOptions#useRangeHeader} or {@link HttpOptions#forceRangeRequests} is set
787
795
  */
788
796
  preventHeadRequest?: boolean;
789
797
  /**
@@ -1221,6 +1229,12 @@ export interface GetEntriesOptions {
1221
1229
  * the content of an entry, it also validates the local file header against the central directory record (see
1222
1230
  * {@link ZipReaderOptions#checkAmbiguity}).
1223
1231
  *
1232
+ * This is the boolean form of {@link GetEntriesOptions#strictness}: `true` means `"strict"` and `false` means
1233
+ * any value but `"strict"`. When both options are set, the value passed to {@link ZipReader#getEntries} takes
1234
+ * precedence over the value passed to the constructor of {@link ZipReader}, and `strictness` takes precedence
1235
+ * over `checkAmbiguity` when both are set at the same level. `false` downgrades an inherited `"strict"` value
1236
+ * to `"balanced"` and leaves an inherited `"tolerant"` value unchanged.
1237
+ *
1224
1238
  * @defaultValue false
1225
1239
  */
1226
1240
  checkAmbiguity?: boolean;
@@ -1362,9 +1376,18 @@ export interface DirectoryEncryptionInfo {
1362
1376
  export interface ZipReaderOptions {
1363
1377
  /**
1364
1378
  * How tolerant the reader should be when the local file header of an entry disagrees with its central
1365
- * directory record. `"strict"` throws an {@link ERR_AMBIGUOUS_ARCHIVE} error (equivalent to
1366
- * {@link ZipReaderOptions#checkAmbiguity} set to `true`); `"balanced"` and `"tolerant"` trust the central
1367
- * directory record.
1379
+ * directory record. Any difference throws an {@link ERR_AMBIGUOUS_ARCHIVE} error.
1380
+ *
1381
+ * - `"strict"`: compare the filename, the general purpose bit flag, the compression method, the CRC-32
1382
+ * checksum and the sizes.
1383
+ * - `"balanced"`: compare everything except the filename.
1384
+ * - `"tolerant"`: compare nothing and trust the central directory record.
1385
+ *
1386
+ * Every field except the filename is read from the local file header anyway, to locate the entry data, so
1387
+ * the comparison `"balanced"` performs reads no additional bytes. Comparing the filename reads the filename
1388
+ * bytes as well, which costs one extra read per entry whenever the local file header carries no extra field
1389
+ * — the common case in practice. Use {@link ZipReaderOptions#checkLocalDirectory} to request or suppress the
1390
+ * whole comparison explicitly.
1368
1391
  *
1369
1392
  * @defaultValue "balanced"
1370
1393
  */
@@ -1377,9 +1400,31 @@ export interface ZipReaderOptions {
1377
1400
  * methods, CRC-32 checksums and sizes. The extra fields are not compared because the zip specification allows
1378
1401
  * them to differ.
1379
1402
  *
1403
+ * This is the boolean form of {@link ZipReaderOptions#strictness}: `true` means `"strict"` and `false` means
1404
+ * any value but `"strict"`. When both options are set, the value passed to {@link FileEntry#getData} takes
1405
+ * precedence over the value passed to the constructor of {@link ZipReader}, and `strictness` takes precedence
1406
+ * over `checkAmbiguity` when both are set at the same level. `false` downgrades an inherited `"strict"` value
1407
+ * to `"balanced"` and leaves an inherited `"tolerant"` value unchanged.
1408
+ *
1380
1409
  * @defaultValue false
1381
1410
  */
1382
1411
  checkAmbiguity?: boolean;
1412
+ /**
1413
+ * `true` to validate the local file header of the entry against its central directory record when calling
1414
+ * {@link FileEntry#getData}, `false` to skip that validation. This is the entry-level half of
1415
+ * {@link ZipReaderOptions#checkAmbiguity}, exposed on its own so it can be enabled without the archive-level
1416
+ * checks and disabled without giving up the rest of {@link ZipReaderOptions#strictness}. It is the only way to
1417
+ * validate the local file headers of a self-extracting archive, since
1418
+ * {@link GetEntriesOptions#checkAmbiguity} rejects prepended data outright.
1419
+ *
1420
+ * `true` compares the filename as well, like {@link ZipReaderOptions#strictness} set to `"strict"`; `false`
1421
+ * compares nothing, like `"tolerant"`. An explicit value takes precedence over the strictness default at
1422
+ * every level.
1423
+ *
1424
+ * @defaultValue `true` when {@link ZipReaderOptions#strictness} is `"strict"` or `"balanced"`, `false` when
1425
+ * it is `"tolerant"`.
1426
+ */
1427
+ checkLocalDirectory?: boolean;
1383
1428
  /**
1384
1429
  * `true` to check only if the password is valid.
1385
1430
  *
@@ -1503,9 +1548,14 @@ export interface EntryExtraFieldAES extends EntryExtraField {
1503
1548
  */
1504
1549
  vendorId?: number;
1505
1550
  /**
1506
- * The compression method stored in the AES extra field.
1551
+ * The compression method stored in the header of the entry, i.e. `99` for a WinZip AES entry.
1507
1552
  */
1508
1553
  originalCompressionMethod?: number;
1554
+ /**
1555
+ * The real compression method of the entry, stored in the AES extra field because the header carries `99`
1556
+ * instead. This is the value reported by {@link EntryMetaData#compressionMethod}.
1557
+ */
1558
+ compressionMethod?: number;
1509
1559
  }
1510
1560
  /**
1511
1561
  * Represents a Unix extra field record storing timestamps: the Info-ZIP Unix type 1 extra field (0x5855),
@@ -1539,7 +1589,149 @@ export interface EntryExtraFieldUnicode extends EntryExtraField {
1539
1589
  * `true` if the extra field is consistent with the entry metadata.
1540
1590
  */
1541
1591
  valid?: boolean;
1592
+ /**
1593
+ * The version of the extra field.
1594
+ */
1595
+ version?: number;
1596
+ /**
1597
+ * The filename stored in the extra field, when it is a Unicode path extra field (0x7075).
1598
+ */
1599
+ filename?: string;
1600
+ /**
1601
+ * The comment stored in the extra field, when it is a Unicode comment extra field (0x6375).
1602
+ */
1603
+ comment?: string;
1604
+ }
1605
+ /**
1606
+ * Represents the Zip64 extra field record of an entry. Each property is only defined when the matching field
1607
+ * of the header was set to its maximum value, i.e. when the real value had to be stored in the extra field.
1608
+ */
1609
+ export interface EntryExtraFieldZip64 extends EntryExtraField {
1610
+ /**
1611
+ * The uncompressed size of the entry.
1612
+ */
1613
+ uncompressedSize?: number;
1614
+ /**
1615
+ * The compressed size of the entry.
1616
+ */
1617
+ compressedSize?: number;
1618
+ /**
1619
+ * The offset of the local file header of the entry.
1620
+ */
1621
+ offset?: number;
1622
+ /**
1623
+ * The number of the disk where the entry data starts.
1624
+ */
1625
+ diskNumberStart?: number;
1626
+ }
1627
+ /**
1628
+ * Represents the NTFS extra field record of an entry (0x000a), storing the dates as Windows `FILETIME` values.
1629
+ */
1630
+ export interface EntryExtraFieldNTFS extends EntryExtraField {
1631
+ /**
1632
+ * The last modification date.
1633
+ */
1634
+ lastModDate?: Date;
1635
+ /**
1636
+ * The last access date.
1637
+ */
1638
+ lastAccessDate?: Date;
1639
+ /**
1640
+ * The creation date.
1641
+ */
1642
+ creationDate?: Date;
1643
+ /**
1644
+ * The last modification date (raw), as a Windows `FILETIME` value.
1645
+ */
1646
+ rawLastModDate?: bigint;
1647
+ /**
1648
+ * The last access date (raw), as a Windows `FILETIME` value.
1649
+ */
1650
+ rawLastAccessDate?: bigint;
1651
+ /**
1652
+ * The creation date (raw), as a Windows `FILETIME` value.
1653
+ */
1654
+ rawCreationDate?: bigint;
1655
+ }
1656
+ /**
1657
+ * Represents the extended timestamp extra field record of an entry (0x5455), storing the dates as 32-bit Unix
1658
+ * times. The central directory record only carries the last modification date, the local file header carries
1659
+ * the dates selected by the flags of the extra field.
1660
+ */
1661
+ export interface EntryExtraFieldExtendedTimestamp extends EntryExtraField {
1662
+ /**
1663
+ * The last modification date.
1664
+ */
1665
+ lastModDate?: Date;
1666
+ /**
1667
+ * The last access date.
1668
+ */
1669
+ lastAccessDate?: Date;
1670
+ /**
1671
+ * The creation date.
1672
+ */
1673
+ creationDate?: Date;
1674
+ /**
1675
+ * The last modification date (raw), as a 32-bit Unix time.
1676
+ */
1677
+ rawLastModDate?: number;
1678
+ /**
1679
+ * The last access date (raw), as a 32-bit Unix time.
1680
+ */
1681
+ rawLastAccessDate?: number;
1682
+ /**
1683
+ * The creation date (raw), as a 32-bit Unix time.
1684
+ */
1685
+ rawCreationDate?: number;
1686
+ }
1687
+ /**
1688
+ * Represents a Unix extra field record storing ownership: the Info-ZIP "new" Unix extra field (0x7875), read
1689
+ * into {@link EntryMetaData#extraFieldInfoZip}, or the Info-ZIP "old" Unix extra field (0x7855), read into
1690
+ * {@link EntryMetaData#extraFieldUnix}.
1691
+ */
1692
+ export interface EntryExtraFieldUnix extends EntryExtraField {
1693
+ /**
1694
+ * The version of the extra field, only defined for the Info-ZIP "new" Unix extra field (0x7875).
1695
+ */
1696
+ version?: number;
1697
+ /**
1698
+ * The Unix user id.
1699
+ */
1700
+ uid?: number;
1701
+ /**
1702
+ * The Unix group id.
1703
+ */
1704
+ gid?: number;
1705
+ }
1706
+ /**
1707
+ * Represents the data descriptor record written after the content of an entry, when
1708
+ * {@link EntryBitFlag#dataDescriptor} is set.
1709
+ */
1710
+ export interface LocalDataDescriptor {
1711
+ /**
1712
+ * `true` if the record is preceded by its optional signature.
1713
+ *
1714
+ * The signature is not part of the original format, it is a later convention writers are free to follow. It is
1715
+ * reported as absent when the values following it disagree with the central directory, since the record is then
1716
+ * read as starting at the first byte.
1717
+ */
1718
+ signature: boolean;
1719
+ /**
1720
+ * The CRC-32 checksum stored in the record, which is allowed to differ from {@link EntryMetaData#crc32}.
1721
+ */
1722
+ crc32: number;
1723
+ /**
1724
+ * The compressed size stored in the record, which is allowed to differ from
1725
+ * {@link EntryMetaData#compressedSize}.
1726
+ */
1727
+ compressedSize: number;
1728
+ /**
1729
+ * The uncompressed size stored in the record, which is allowed to differ from
1730
+ * {@link EntryMetaData#uncompressedSize}.
1731
+ */
1732
+ uncompressedSize: number;
1542
1733
  }
1734
+
1543
1735
  /**
1544
1736
  * Represents the local file header fields of an entry, read when getting the entry data.
1545
1737
  */
@@ -1584,6 +1776,23 @@ export interface LocalDirectory {
1584
1776
  * The extra field.
1585
1777
  */
1586
1778
  extraField?: Map<number, EntryExtraField>;
1779
+ /**
1780
+ * The filename of the entry stored in the local file header (raw), which is allowed to differ from
1781
+ * {@link EntryMetaData#rawFilename}.
1782
+ *
1783
+ * Only defined when the local filename has been read, i.e. when the {@link ZipReaderOptions#strictness} option
1784
+ * is set to `"strict"` or when the {@link ZipReaderOptions#checkLocalDirectory} option is set to `true`, since
1785
+ * reading it costs one read the central directory does not need.
1786
+ */
1787
+ rawFilename?: Uint8Array;
1788
+ /**
1789
+ * The data descriptor record written after the content, when the entry has one.
1790
+ *
1791
+ * Only defined when the record has been read, i.e. when the {@link ZipReaderOptions#checkOverlappingEntry} or
1792
+ * the {@link ZipReaderOptions#checkOverlappingEntryOnly} option is set to `true`, since the sizes stored in the
1793
+ * central directory make it unnecessary to read it otherwise.
1794
+ */
1795
+ dataDescriptor?: LocalDataDescriptor;
1587
1796
  /**
1588
1797
  * The CRC-32 checksum of the content.
1589
1798
  */
@@ -1609,7 +1818,7 @@ export interface LocalDirectory {
1609
1818
  /**
1610
1819
  * The Zip64 extra field.
1611
1820
  */
1612
- extraFieldZip64?: EntryExtraField;
1821
+ extraFieldZip64?: EntryExtraFieldZip64;
1613
1822
  /**
1614
1823
  * The AES extra field.
1615
1824
  */
@@ -1617,16 +1826,18 @@ export interface LocalDirectory {
1617
1826
  /**
1618
1827
  * The NTFS extra field.
1619
1828
  */
1620
- extraFieldNTFS?: EntryExtraField;
1829
+ extraFieldNTFS?: EntryExtraFieldNTFS;
1621
1830
  /**
1622
1831
  * The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
1623
1832
  * central directory version carries no data and merely flags their presence.
1624
1833
  */
1625
- extraFieldUnix?: EntryExtraField;
1834
+ extraFieldUnix?: EntryExtraFieldUnix;
1626
1835
  /**
1627
- * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers.
1836
+ * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It is read
1837
+ * whenever the type 2 extra field (0x7855) is absent or carries no ids, which is its usual state in the
1838
+ * central directory.
1628
1839
  */
1629
- extraFieldInfoZip?: EntryExtraField;
1840
+ extraFieldInfoZip?: EntryExtraFieldUnix;
1630
1841
  /**
1631
1842
  * The Info-ZIP Unix type 1 extra field (0x5855).
1632
1843
  */
@@ -1638,7 +1849,7 @@ export interface LocalDirectory {
1638
1849
  /**
1639
1850
  * The extended timestamp extra field.
1640
1851
  */
1641
- extraFieldExtendedTimestamp?: EntryExtraField;
1852
+ extraFieldExtendedTimestamp?: EntryExtraFieldExtendedTimestamp;
1642
1853
  /**
1643
1854
  * The Unicode path extra field.
1644
1855
  */
@@ -1722,6 +1933,10 @@ export interface EntryMetaData {
1722
1933
  *
1723
1934
  * The path is not validated: it can be absolute or escape the archive with `..` segments. It must
1724
1935
  * be checked before being used to resolve a file.
1936
+ *
1937
+ * There is no option to write a symbolic link. Set the file type in
1938
+ * {@link ZipWriterConstructorOptions#unixMode} instead, i.e. pass `0o120777` with the path of the
1939
+ * target as the content of the entry.
1725
1940
  */
1726
1941
  symlink: boolean;
1727
1942
  /**
@@ -1753,15 +1968,19 @@ export interface EntryMetaData {
1753
1968
  */
1754
1969
  creationDate?: Date;
1755
1970
  /**
1756
- * The last modification date (raw).
1971
+ * The last modification date (raw), as the MS-DOS date and time stored in the header. Unlike
1972
+ * {@link EntryMetaData#lastModDate}, it is not replaced by the value of the NTFS extra field when that field
1973
+ * is present; read {@link EntryMetaData#extraFieldNTFS} for the raw NTFS value.
1757
1974
  */
1758
1975
  rawLastModDate: number | bigint;
1759
1976
  /**
1760
- * The last access date (raw).
1977
+ * The last access date (raw), as the Windows `FILETIME` value stored in the NTFS extra field. Only defined
1978
+ * when that extra field is present.
1761
1979
  */
1762
1980
  rawLastAccessDate?: number | bigint;
1763
1981
  /**
1764
- * The creation date (raw).
1982
+ * The creation date (raw), as the Windows `FILETIME` value stored in the NTFS extra field. Only defined when
1983
+ * that extra field is present.
1765
1984
  */
1766
1985
  rawCreationDate?: number | bigint;
1767
1986
  /**
@@ -1850,9 +2069,12 @@ export interface EntryMetaData {
1850
2069
  *
1851
2070
  * The value is read from the central directory. The Info-ZIP Unix extra fields type 1 (0x5855) and type 2
1852
2071
  * (0x7855) store the ids in the local file header only, so entries carrying just these fields leave the
1853
- * property undefined until the data has been read; the ids are then available in
2072
+ * property undefined until the data has been read, at which point it is filled in from
1854
2073
  * {@link EntryMetaData#localDirectory}. The Info-ZIP New Unix extra field (0x7875) and the PKWARE Unix
1855
2074
  * extra field (0x000d) store the ids in both headers and are unaffected.
2075
+ *
2076
+ * @remarks A value read from the central directory is never overwritten by the local file header, since the
2077
+ * type 2 field truncates the ids to 16 bits while the New Unix field does not.
1856
2078
  */
1857
2079
  uid?: number;
1858
2080
  /**
@@ -1934,7 +2156,7 @@ export interface EntryMetaData {
1934
2156
  /**
1935
2157
  * The Zip64 extra field.
1936
2158
  */
1937
- extraFieldZip64?: EntryExtraField;
2159
+ extraFieldZip64?: EntryExtraFieldZip64;
1938
2160
  /**
1939
2161
  * The AES extra field.
1940
2162
  */
@@ -1942,16 +2164,18 @@ export interface EntryMetaData {
1942
2164
  /**
1943
2165
  * The NTFS extra field.
1944
2166
  */
1945
- extraFieldNTFS?: EntryExtraField;
2167
+ extraFieldNTFS?: EntryExtraFieldNTFS;
1946
2168
  /**
1947
2169
  * The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
1948
2170
  * central directory version carries no data and merely flags their presence.
1949
2171
  */
1950
- extraFieldUnix?: EntryExtraField;
2172
+ extraFieldUnix?: EntryExtraFieldUnix;
1951
2173
  /**
1952
- * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers.
2174
+ * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It is read
2175
+ * whenever the type 2 extra field (0x7855) is absent or carries no ids, which is its usual state in the
2176
+ * central directory.
1953
2177
  */
1954
- extraFieldInfoZip?: EntryExtraField;
2178
+ extraFieldInfoZip?: EntryExtraFieldUnix;
1955
2179
  /**
1956
2180
  * The Info-ZIP Unix type 1 extra field (0x5855).
1957
2181
  */
@@ -1963,7 +2187,7 @@ export interface EntryMetaData {
1963
2187
  /**
1964
2188
  * The extended timestamp extra field.
1965
2189
  */
1966
- extraFieldExtendedTimestamp?: EntryExtraField;
2190
+ extraFieldExtendedTimestamp?: EntryExtraFieldExtendedTimestamp;
1967
2191
  /**
1968
2192
  * The Unicode path extra field.
1969
2193
  */
@@ -2435,7 +2659,8 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
2435
2659
  *
2436
2660
  * This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to `false`.
2437
2661
  *
2438
- * @defaultValue The current date.
2662
+ * Unlike {@link ZipWriterConstructorOptions#lastModDate}, it has no default: the date is written only when the
2663
+ * option is set, so that the entries do not carry a meaningless access time.
2439
2664
  */
2440
2665
  lastAccessDate?: Date;
2441
2666
  /**
@@ -2443,7 +2668,8 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
2443
2668
  *
2444
2669
  * This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to `false`.
2445
2670
  *
2446
- * @defaultValue The current date.
2671
+ * Unlike {@link ZipWriterConstructorOptions#lastModDate}, it has no default: the date is written only when the
2672
+ * option is set, so that the entries do not carry a meaningless creation time.
2447
2673
  */
2448
2674
  creationDate?: Date;
2449
2675
  /**
@@ -2478,9 +2704,18 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
2478
2704
  */
2479
2705
  version?: number;
2480
2706
  /**
2481
- * The "Version made by" field.
2707
+ * The "Version made by" field, whose upper byte is the platform and lower byte the version of the
2708
+ * specification.
2709
+ *
2710
+ * The platform is not taken from the value passed here. It is forced to Unix (`3`) when the entry carries Unix
2711
+ * metadata, i.e. when {@link ZipWriterConstructorOptions#uid}, {@link ZipWriterConstructorOptions#gid},
2712
+ * {@link ZipWriterConstructorOptions#unixMode} or {@link ZipWriterConstructorOptions#unixExtraFieldType} is set,
2713
+ * since Unix mode bits stored under another platform are ignored by the extractors. It is forced to MS-DOS (`0`)
2714
+ * when {@link ZipWriterConstructorOptions#msdosAttributes} or
2715
+ * {@link ZipWriterConstructorOptions#msdosAttributesRaw} is set. Only the lower byte of the value survives in
2716
+ * both cases.
2482
2717
  *
2483
- * @defaultValue 20
2718
+ * @defaultValue 768, i.e. `3 << 8`, or 20 when {@link ZipWriterConstructorOptions#msDosCompatible} is set to `true`
2484
2719
  */
2485
2720
  versionMadeBy?: number;
2486
2721
  /**
@@ -2510,6 +2745,10 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
2510
2745
  /**
2511
2746
  * `true` to write {@link EntryMetaData#externalFileAttributes} in MS-DOS format for folder entries.
2512
2747
  *
2748
+ * It also selects the MS-DOS platform for {@link ZipWriterConstructorOptions#versionMadeBy} and leaves the Unix
2749
+ * attributes out of the entries. Setting any Unix metadata option, e.g.
2750
+ * {@link ZipWriterConstructorOptions#unixMode}, turns it back off.
2751
+ *
2513
2752
  * @defaultValue false
2514
2753
  */
2515
2754
  msDosCompatible?: boolean;
@@ -2543,8 +2782,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
2543
2782
  * `0o120777` and use the path of the link target as the content of the entry. Extractors that
2544
2783
  * support symbolic links, e.g. Info-ZIP `unzip`, then restore the entry as a link.
2545
2784
  *
2546
- * When the value carries no file type, the type of the entry is added: `S_IFDIR` (`0o040000`)
2547
- * for a folder entry, `S_IFREG` (`0o100000`) otherwise. Set
2785
+ * A folder entry is always written with `S_IFDIR` (`0o040000`), replacing any file type carried by the
2786
+ * value, so the same mode can be set once on the writer and reused for every entry. Any other entry keeps
2787
+ * the file type it is given, and is written with `S_IFREG` (`0o100000`) when the value carries none. Set
2548
2788
  * {@link ZipWriterConstructorOptions#externalFileAttributes} instead to write a mode with no
2549
2789
  * file type.
2550
2790
  */
@@ -3513,20 +3753,14 @@ export class FS {
3513
3753
  export const fs: {
3514
3754
  /**
3515
3755
  * The Filesystem constructor.
3516
- *
3517
- * @defaultValue {@link FS}
3518
3756
  */
3519
3757
  FS: typeof FS;
3520
3758
  /**
3521
3759
  * The {@link ZipDirectoryEntry} constructor.
3522
- *
3523
- * @defaultValue {@link ZipDirectoryEntry}
3524
3760
  */
3525
3761
  ZipDirectoryEntry: typeof ZipDirectoryEntry;
3526
3762
  /**
3527
3763
  * The {@link ZipFileEntry} constructor.
3528
- *
3529
- * @defaultValue {@link ZipFileEntry}
3530
3764
  */
3531
3765
  ZipFileEntry: typeof ZipFileEntry;
3532
3766
  };
@@ -3643,6 +3877,10 @@ export const ERR_DUPLICATED_NAME: string;
3643
3877
  * Invalid comment error
3644
3878
  */
3645
3879
  export const ERR_INVALID_COMMENT: string;
3880
+ /**
3881
+ * Invalid comment type error
3882
+ */
3883
+ export const ERR_INVALID_COMMENT_TYPE: string;
3646
3884
  /**
3647
3885
  * Invalid entry name error
3648
3886
  */