@zip.js/zip.js 2.18.2 → 2.19.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 +122 -118
  2. package/deno.json +1 -1
  3. package/dist/zip-core-external.js +54 -81
  4. package/dist/zip-core-external.min.js +1 -1
  5. package/dist/zip-core.js +54 -81
  6. package/dist/zip-core.min.js +1 -1
  7. package/dist/zip-fs-core-external.js +54 -81
  8. package/dist/zip-fs-core-external.min.js +1 -1
  9. package/dist/zip-fs-core.js +54 -81
  10. package/dist/zip-fs-core.min.js +1 -1
  11. package/dist/zip-fs-external.js +54 -81
  12. package/dist/zip-fs-external.min.js +1 -1
  13. package/dist/zip-fs-native.js +56 -83
  14. package/dist/zip-fs-native.min.js +1 -1
  15. package/dist/zip-fs.js +55 -82
  16. package/dist/zip-fs.min.js +1 -1
  17. package/dist/zip-legacy.js +56 -83
  18. package/dist/zip-legacy.min.js +1 -1
  19. package/dist/zip-native.js +56 -83
  20. package/dist/zip-native.min.js +1 -1
  21. package/dist/zip-web-worker-native.js +1 -1
  22. package/dist/zip-web-worker.js +1 -1
  23. package/dist/zip.js +55 -82
  24. package/dist/zip.min.js +1 -1
  25. package/index-native.cjs +56 -83
  26. package/index-native.min.js +1 -1
  27. package/index.cjs +55 -82
  28. package/index.d.cts +27 -18
  29. package/index.d.ts +27 -18
  30. package/index.min.js +1 -1
  31. package/lib/core/codec-pool.js +1 -2
  32. package/lib/core/codec-worker-web.js +11 -39
  33. package/lib/core/codec-worker.js +1 -2
  34. package/lib/core/configuration.js +1 -1
  35. package/lib/core/options.js +0 -2
  36. package/lib/core/streams/codec-stream.js +1 -1
  37. package/lib/core/version.js +1 -1
  38. package/lib/core/web-worker-base.js +2 -3
  39. package/lib/core/web-worker-inline-native.js +1 -1
  40. package/lib/core/web-worker-inline-wasm.js +1 -1
  41. package/lib/core/zip-reader.js +21 -23
  42. package/lib/core/zip-writer.js +18 -14
  43. package/package.json +1 -1
  44. package/worker-message-property-names.js +1 -1
package/index.d.ts CHANGED
@@ -569,7 +569,11 @@ export interface Configuration extends WorkerConfiguration {
569
569
  * Values lower than 64 are raised to 64, and a value that is not an integer greater than 0 is replaced with the default
570
570
  * value.
571
571
  *
572
- * @defaultValue 65536
572
+ * @remarks
573
+ * Every stage of the pipeline of an entry holds up to one chunk, and the data crosses the boundary of a web worker one
574
+ * chunk per message, so a larger value costs more memory per entry in progress and buys fewer messages.
575
+ *
576
+ * @defaultValue 262144
573
577
  */
574
578
  chunkSize?: number;
575
579
  /**
@@ -634,7 +638,8 @@ export interface WorkerConfiguration {
634
638
  /**
635
639
  * `true` to transfer stream ownership to web workers.
636
640
  *
637
- * @defaultValue true
641
+ * @deprecated The option is ignored whatever its value: the data always crosses the worker boundary chunk by
642
+ * chunk, transferring the streams instead was slower on every engine measured.
638
643
  */
639
644
  transferStreams?: boolean;
640
645
  }
@@ -919,7 +924,7 @@ export class Reader<Type> implements Initializable, ReadableReader {
919
924
  */
920
925
  constructor(value: Type);
921
926
  /**
922
- * The `ReadableStream` instance.
927
+ * The `ReadableStream` instance, a new one reading the data from its start on each access.
923
928
  */
924
929
  readable: ReadableStream;
925
930
  /**
@@ -1754,7 +1759,8 @@ export interface GetEntriesOptions {
1754
1759
  * another charset.
1755
1760
  *
1756
1761
  * Names are validated, never rewritten, so the filename reported for an entry always matches its central
1757
- * directory record.
1762
+ * directory record. The name validated is the final one, i.e. the name of a valid Unicode Path extra field
1763
+ * (see {@link EntryMetaData#extraFieldUnicodePath}) when the entry carries one.
1758
1764
  *
1759
1765
  * @defaultValue The value of {@link GetEntriesOptions#strictness}.
1760
1766
  */
@@ -1763,8 +1769,9 @@ export interface GetEntriesOptions {
1763
1769
  * The function called for normalizing the filename of each entry, e.g. to repair the names rejected by
1764
1770
  * {@link GetEntriesOptions#filenameValidation}.
1765
1771
  *
1766
- * It is called with the decoded filename, after {@link GetEntriesOptions#decodeText} and before the name is
1767
- * validated, so a name it fails to repair is still rejected. The returned name becomes the name of the entry:
1772
+ * It is called with the decoded filename, after {@link GetEntriesOptions#decodeText} and after a valid Unicode
1773
+ * Path extra field (see {@link EntryMetaData#extraFieldUnicodePath}) has replaced the name, and before the name
1774
+ * is validated, so a name it fails to repair is still rejected. The returned name becomes the name of the entry:
1768
1775
  * it is used to detect directory entries by their trailing `"/"`, and to detect duplicate filenames when
1769
1776
  * {@link GetEntriesOptions#checkAmbiguity} is set, so two names normalized into the same name are reported as
1770
1777
  * an {@link ERR_AMBIGUOUS_ARCHIVE} error instead of silently shadowing each other. The raw filename remains
@@ -2378,13 +2385,13 @@ export interface LocalDirectory {
2378
2385
  extraFieldNTFS?: EntryExtraFieldNTFS;
2379
2386
  /**
2380
2387
  * The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
2381
- * central directory version carries no data and merely flags their presence.
2388
+ * central directory version carries no data and merely flags their presence. Its ids are used when the
2389
+ * header holds no New Unix extra field (0x7875).
2382
2390
  */
2383
2391
  extraFieldUnix?: EntryExtraFieldUnix;
2384
2392
  /**
2385
- * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It is read
2386
- * whenever the type 2 extra field (0x7855) is absent or carries no ids, which is its usual state in the
2387
- * central directory.
2393
+ * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It takes
2394
+ * precedence over the type 2 extra field (0x7855) when a header carries both.
2388
2395
  */
2389
2396
  extraFieldInfoZip?: EntryExtraFieldUnix;
2390
2397
  /**
@@ -2747,13 +2754,13 @@ export interface EntryMetaData {
2747
2754
  extraFieldNTFS?: EntryExtraFieldNTFS;
2748
2755
  /**
2749
2756
  * The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
2750
- * central directory version carries no data and merely flags their presence.
2757
+ * central directory version carries no data and merely flags their presence. Its ids are used when the
2758
+ * header holds no New Unix extra field (0x7875).
2751
2759
  */
2752
2760
  extraFieldUnix?: EntryExtraFieldUnix;
2753
2761
  /**
2754
- * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It is read
2755
- * whenever the type 2 extra field (0x7855) is absent or carries no ids, which is its usual state in the
2756
- * central directory.
2762
+ * The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It takes
2763
+ * precedence over the type 2 extra field (0x7855) when a header carries both.
2757
2764
  */
2758
2765
  extraFieldInfoZip?: EntryExtraFieldUnix;
2759
2766
  /**
@@ -2785,8 +2792,8 @@ export interface EntryMetaData {
2785
2792
  *
2786
2793
  * The local file header is the only place where the Info-ZIP Unix extra fields type 1 (0x5855) and type 2
2787
2794
  * (0x7855) store the uid/gid, so this is where they are read for entries carrying just these fields, e.g.
2788
- * with `entry.localDirectory.extraFieldUnixType1.uid`. The values are not merged into
2789
- * {@link EntryMetaData#uid} and {@link EntryMetaData#gid}, which are read from the central directory.
2795
+ * with `entry.localDirectory.extraFieldUnixType1.uid`. The values fill in {@link EntryMetaData#uid} and
2796
+ * {@link EntryMetaData#gid} only when the central directory gave none, see {@link EntryMetaData#uid}.
2790
2797
  */
2791
2798
  localDirectory?: LocalDirectory;
2792
2799
  /**
@@ -3649,8 +3656,10 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
3649
3656
  * Which Unix extra field format to write when creating entries that include Unix metadata.
3650
3657
  * - "infozip": Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid up to 32 bits.
3651
3658
  * - "unix": Info-ZIP Unix extra field type 2 (0x7855), storing fixed 2-byte uid/gid (0..65535); a
3652
- * larger uid or gid is rejected. The Unix mode is not part of this field; it is written to the
3653
- * external file attributes.
3659
+ * larger uid or gid is rejected. The ids are written in the local file header only, the central
3660
+ * directory copy is empty as Info-ZIP specifies, so a reader working from the central directory,
3661
+ * {@link ZipReader} included, reports them once the entry data has been read. The Unix mode is not
3662
+ * part of this field; it is written to the external file attributes.
3654
3663
  *
3655
3664
  * When {@link ZipFS} exports imported entries, their uid/gid are re-emitted as "infozip" regardless
3656
3665
  * of the field type found in the imported zip file, unless this option is set explicitly.