@zip.js/zip.js 2.14.0 → 2.15.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 (44) hide show
  1. package/BENCHMARKS.md +350 -454
  2. package/deno.json +1 -1
  3. package/dist/zip-core-external.js +342 -120
  4. package/dist/zip-core-external.min.js +1 -1
  5. package/dist/zip-core.js +340 -113
  6. package/dist/zip-core.min.js +1 -1
  7. package/dist/zip-fs-core-external.js +342 -120
  8. package/dist/zip-fs-core-external.min.js +1 -1
  9. package/dist/zip-fs-core.js +340 -113
  10. package/dist/zip-fs-core.min.js +1 -1
  11. package/dist/zip-fs-external.js +342 -120
  12. package/dist/zip-fs-external.min.js +1 -1
  13. package/dist/zip-fs-native.js +342 -115
  14. package/dist/zip-fs-native.min.js +1 -1
  15. package/dist/zip-fs.js +346 -124
  16. package/dist/zip-fs.min.js +1 -1
  17. package/dist/zip-legacy.js +342 -115
  18. package/dist/zip-legacy.min.js +1 -1
  19. package/dist/zip-module.wasm +0 -0
  20. package/dist/zip-native.js +342 -115
  21. package/dist/zip-native.min.js +1 -1
  22. package/dist/zip-web-worker-native.js +1 -1
  23. package/dist/zip-web-worker.js +1 -1
  24. package/dist/zip.js +346 -124
  25. package/dist/zip.min.js +1 -1
  26. package/index-native.cjs +342 -115
  27. package/index-native.min.js +1 -1
  28. package/index.cjs +346 -124
  29. package/index.d.cts +20 -13
  30. package/index.d.ts +20 -13
  31. package/index.min.js +1 -1
  32. package/lib/core/codec-pool.js +35 -19
  33. package/lib/core/codec-worker.js +9 -6
  34. package/lib/core/streams/codecs/aes-hmac-sha1.js +194 -56
  35. package/lib/core/streams/zip-entry-stream.js +18 -10
  36. package/lib/core/streams/zlib-wasm/zlib-streams.js +2 -7
  37. package/lib/core/streams/zlib-wasm/zlib-streams.wasm +0 -0
  38. package/lib/core/util/decode-text.js +15 -1
  39. package/lib/core/version.js +1 -1
  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-reader.js +65 -16
  43. package/lib/core/zlib-streams-inline.js +1 -1
  44. package/package.json +1 -1
package/index.d.cts CHANGED
@@ -1646,15 +1646,18 @@ export interface GetEntriesOptions {
1646
1646
  * The encoding of the filename of the entry.
1647
1647
  *
1648
1648
  * The option is ignored when the general purpose bit 11 is set in the header of the entry: such a
1649
- * filename is always decoded as UTF-8. It is only read when the bit is not set, and the filename is
1650
- * then decoded as IBM Code Page 437 when the option is not set either.
1649
+ * filename is always decoded as UTF-8. It is only read when the bit is not set. When the option is not
1650
+ * set either, a filename holding bytes outside ASCII is decoded as UTF-8 if they form valid UTF-8, since
1651
+ * many writers store UTF-8 without setting the bit (macOS Archive Utility, `ditto`, the macOS build of
1652
+ * Info-ZIP `zip`, Java 6), and as IBM Code Page 437 otherwise. Set the option to decode such filenames
1653
+ * as another legacy encoding instead.
1651
1654
  */
1652
1655
  filenameEncoding?: string;
1653
1656
  /**
1654
1657
  * The encoding of the comment of the entry.
1655
1658
  *
1656
- * The option is ignored when the general purpose bit 11 is set in the header of the entry, see
1657
- * {@link GetEntriesOptions#filenameEncoding}.
1659
+ * The option is ignored when the general purpose bit 11 is set in the header of the entry, and valid
1660
+ * UTF-8 is detected when the option is not set, see {@link GetEntriesOptions#filenameEncoding}.
1658
1661
  */
1659
1662
  commentEncoding?: string;
1660
1663
  /**
@@ -1670,9 +1673,11 @@ export interface GetEntriesOptions {
1670
1673
  * `true` to throw an {@link ERR_AMBIGUOUS_ARCHIVE} error when the archive could be parsed differently by other
1671
1674
  * tools. This detects data before or after the zip structure (e.g. a self-extracting archive stub or a
1672
1675
  * concatenated archive), central directory records not accounted for by the end of central directory record, an
1673
- * end of central directory record disagreeing with its zip64 counterpart, and duplicate filenames. When reading
1674
- * the content of an entry, it also validates the local file header against the central directory record (see
1675
- * {@link ZipReaderOptions#checkAmbiguity}).
1676
+ * end of central directory record disagreeing with its zip64 counterpart, and duplicate filenames. Filenames are
1677
+ * compared exactly, after {@link GetEntriesOptions#normalizeFilename}: two names differing only by letter case or
1678
+ * by Unicode normalization form are distinct entries, even though they collide on a case-insensitive or
1679
+ * normalizing filesystem. When reading the content of an entry, it also validates the local file header against
1680
+ * the central directory record (see {@link ZipReaderOptions#checkAmbiguity}).
1676
1681
  *
1677
1682
  * This is the boolean form of {@link GetEntriesOptions#strictness}: `true` means `"strict"` and `false` means
1678
1683
  * any value but `"strict"`. When both options are set, the value passed to {@link ZipReader#getEntries} takes
@@ -1710,15 +1715,17 @@ export interface GetEntriesOptions {
1710
1715
  * {@link ERR_UNSAFE_FILENAME} error carrying the offending name in its `filename` property.
1711
1716
  *
1712
1717
  * - `"strict"`: reject the names rejected by `"balanced"`, plus the names that do not map cleanly to a file
1713
- * path, i.e. empty names and names containing a `"."` path component or an empty one (e.g. `"a//b.txt"`).
1718
+ * path, i.e. empty names, names containing a `"."` path component or an empty one (e.g. `"a//b.txt"`), and
1719
+ * names containing a NUL character.
1714
1720
  * - `"balanced"`: reject names that would escape the directory they are extracted into, i.e. names containing
1715
- * a `".."` path component, and absolute names, i.e. names starting with `"/"`, with a drive letter (e.g.
1716
- * `"C:/file.txt"`) or with two backslashes (UNC paths).
1721
+ * a `".."` path component delimited by slashes or by backslashes (e.g. `"..\\file.txt"`, which a Windows host
1722
+ * resolves as a parent directory), and absolute names, i.e. names starting with `"/"`, with a drive letter
1723
+ * (e.g. `"C:/file.txt"`) or with a backslash (root-relative and UNC paths on Windows).
1717
1724
  * - `"tolerant"`: never reject a name.
1718
1725
  *
1719
- * A backslash is never interpreted as a path separator: it is a valid filename character on UNIX systems, and
1720
- * it also occurs as the trail byte of legitimate double-byte filenames (e.g. CP932) decoded with another
1721
- * charset.
1726
+ * A backslash is otherwise not interpreted as a path separator: it is a valid filename character on UNIX
1727
+ * systems, and it also occurs as the trail byte of legitimate double-byte filenames (e.g. CP932) decoded with
1728
+ * another charset.
1722
1729
  *
1723
1730
  * Names are validated, never rewritten, so the filename reported for an entry always matches its central
1724
1731
  * directory record.
package/index.d.ts CHANGED
@@ -1646,15 +1646,18 @@ export interface GetEntriesOptions {
1646
1646
  * The encoding of the filename of the entry.
1647
1647
  *
1648
1648
  * The option is ignored when the general purpose bit 11 is set in the header of the entry: such a
1649
- * filename is always decoded as UTF-8. It is only read when the bit is not set, and the filename is
1650
- * then decoded as IBM Code Page 437 when the option is not set either.
1649
+ * filename is always decoded as UTF-8. It is only read when the bit is not set. When the option is not
1650
+ * set either, a filename holding bytes outside ASCII is decoded as UTF-8 if they form valid UTF-8, since
1651
+ * many writers store UTF-8 without setting the bit (macOS Archive Utility, `ditto`, the macOS build of
1652
+ * Info-ZIP `zip`, Java 6), and as IBM Code Page 437 otherwise. Set the option to decode such filenames
1653
+ * as another legacy encoding instead.
1651
1654
  */
1652
1655
  filenameEncoding?: string;
1653
1656
  /**
1654
1657
  * The encoding of the comment of the entry.
1655
1658
  *
1656
- * The option is ignored when the general purpose bit 11 is set in the header of the entry, see
1657
- * {@link GetEntriesOptions#filenameEncoding}.
1659
+ * The option is ignored when the general purpose bit 11 is set in the header of the entry, and valid
1660
+ * UTF-8 is detected when the option is not set, see {@link GetEntriesOptions#filenameEncoding}.
1658
1661
  */
1659
1662
  commentEncoding?: string;
1660
1663
  /**
@@ -1670,9 +1673,11 @@ export interface GetEntriesOptions {
1670
1673
  * `true` to throw an {@link ERR_AMBIGUOUS_ARCHIVE} error when the archive could be parsed differently by other
1671
1674
  * tools. This detects data before or after the zip structure (e.g. a self-extracting archive stub or a
1672
1675
  * concatenated archive), central directory records not accounted for by the end of central directory record, an
1673
- * end of central directory record disagreeing with its zip64 counterpart, and duplicate filenames. When reading
1674
- * the content of an entry, it also validates the local file header against the central directory record (see
1675
- * {@link ZipReaderOptions#checkAmbiguity}).
1676
+ * end of central directory record disagreeing with its zip64 counterpart, and duplicate filenames. Filenames are
1677
+ * compared exactly, after {@link GetEntriesOptions#normalizeFilename}: two names differing only by letter case or
1678
+ * by Unicode normalization form are distinct entries, even though they collide on a case-insensitive or
1679
+ * normalizing filesystem. When reading the content of an entry, it also validates the local file header against
1680
+ * the central directory record (see {@link ZipReaderOptions#checkAmbiguity}).
1676
1681
  *
1677
1682
  * This is the boolean form of {@link GetEntriesOptions#strictness}: `true` means `"strict"` and `false` means
1678
1683
  * any value but `"strict"`. When both options are set, the value passed to {@link ZipReader#getEntries} takes
@@ -1710,15 +1715,17 @@ export interface GetEntriesOptions {
1710
1715
  * {@link ERR_UNSAFE_FILENAME} error carrying the offending name in its `filename` property.
1711
1716
  *
1712
1717
  * - `"strict"`: reject the names rejected by `"balanced"`, plus the names that do not map cleanly to a file
1713
- * path, i.e. empty names and names containing a `"."` path component or an empty one (e.g. `"a//b.txt"`).
1718
+ * path, i.e. empty names, names containing a `"."` path component or an empty one (e.g. `"a//b.txt"`), and
1719
+ * names containing a NUL character.
1714
1720
  * - `"balanced"`: reject names that would escape the directory they are extracted into, i.e. names containing
1715
- * a `".."` path component, and absolute names, i.e. names starting with `"/"`, with a drive letter (e.g.
1716
- * `"C:/file.txt"`) or with two backslashes (UNC paths).
1721
+ * a `".."` path component delimited by slashes or by backslashes (e.g. `"..\\file.txt"`, which a Windows host
1722
+ * resolves as a parent directory), and absolute names, i.e. names starting with `"/"`, with a drive letter
1723
+ * (e.g. `"C:/file.txt"`) or with a backslash (root-relative and UNC paths on Windows).
1717
1724
  * - `"tolerant"`: never reject a name.
1718
1725
  *
1719
- * A backslash is never interpreted as a path separator: it is a valid filename character on UNIX systems, and
1720
- * it also occurs as the trail byte of legitimate double-byte filenames (e.g. CP932) decoded with another
1721
- * charset.
1726
+ * A backslash is otherwise not interpreted as a path separator: it is a valid filename character on UNIX
1727
+ * systems, and it also occurs as the trail byte of legitimate double-byte filenames (e.g. CP932) decoded with
1728
+ * another charset.
1722
1729
  *
1723
1730
  * Names are validated, never rewritten, so the filename reported for an entry always matches its central
1724
1731
  * directory record.