@zip.js/zip.js 2.18.1 → 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.
- package/BENCHMARKS.md +122 -118
- package/deno.json +1 -1
- package/dist/zip-core-external.js +59 -94
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +59 -94
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +59 -94
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +59 -94
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +59 -94
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +61 -96
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +60 -95
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +61 -96
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +61 -96
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +60 -95
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +61 -96
- package/index-native.min.js +1 -1
- package/index.cjs +60 -95
- package/index.d.cts +33 -23
- package/index.d.ts +33 -23
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +1 -2
- package/lib/core/codec-worker-web.js +11 -39
- package/lib/core/codec-worker.js +1 -2
- package/lib/core/configuration.js +1 -1
- package/lib/core/options.js +0 -2
- package/lib/core/streams/codec-stream.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +2 -3
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +26 -36
- package/lib/core/zip-writer.js +18 -14
- package/package.json +1 -1
- package/worker-message-property-names.js +1 -1
package/index.d.cts
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
|
1767
|
-
*
|
|
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
|
|
@@ -2240,8 +2247,8 @@ export interface LocalDataDescriptor {
|
|
|
2240
2247
|
* `true` if the record is preceded by its optional signature.
|
|
2241
2248
|
*
|
|
2242
2249
|
* The signature is not part of the original format, it is a later convention writers are free to follow. It is
|
|
2243
|
-
*
|
|
2244
|
-
*
|
|
2250
|
+
* `false` when the record is read as starting at its first byte, see {@link LocalDataDescriptor#zip64} for how the
|
|
2251
|
+
* layout is chosen.
|
|
2245
2252
|
*/
|
|
2246
2253
|
signature: boolean;
|
|
2247
2254
|
/**
|
|
@@ -2251,9 +2258,10 @@ export interface LocalDataDescriptor {
|
|
|
2251
2258
|
* sizes, and the Zip64 extra field of the central directory record, written last, describes that record, not the
|
|
2252
2259
|
* descriptor, so e.g. an entry placed past 4 GB can carry a Zip64 extra field in its central directory record for
|
|
2253
2260
|
* its offset alone and a descriptor with 4-byte sizes. The record is therefore read with the layout, among the two
|
|
2254
|
-
* widths with and without the signature, whose
|
|
2255
|
-
*
|
|
2256
|
-
* the signature
|
|
2261
|
+
* widths with and without the signature, whose sizes agree with the central directory, its CRC-32 too when the
|
|
2262
|
+
* central directory stores one and several layouts qualify; when none does, the width announced by the Zip64 extra
|
|
2263
|
+
* field of the local file header or of the central directory record is used, with the signature when the record
|
|
2264
|
+
* starts with one.
|
|
2257
2265
|
*/
|
|
2258
2266
|
zip64: boolean;
|
|
2259
2267
|
/**
|
|
@@ -2377,13 +2385,13 @@ export interface LocalDirectory {
|
|
|
2377
2385
|
extraFieldNTFS?: EntryExtraFieldNTFS;
|
|
2378
2386
|
/**
|
|
2379
2387
|
* The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
|
|
2380
|
-
* 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).
|
|
2381
2390
|
*/
|
|
2382
2391
|
extraFieldUnix?: EntryExtraFieldUnix;
|
|
2383
2392
|
/**
|
|
2384
|
-
* The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It
|
|
2385
|
-
*
|
|
2386
|
-
* 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.
|
|
2387
2395
|
*/
|
|
2388
2396
|
extraFieldInfoZip?: EntryExtraFieldUnix;
|
|
2389
2397
|
/**
|
|
@@ -2746,13 +2754,13 @@ export interface EntryMetaData {
|
|
|
2746
2754
|
extraFieldNTFS?: EntryExtraFieldNTFS;
|
|
2747
2755
|
/**
|
|
2748
2756
|
* The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
|
|
2749
|
-
* 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).
|
|
2750
2759
|
*/
|
|
2751
2760
|
extraFieldUnix?: EntryExtraFieldUnix;
|
|
2752
2761
|
/**
|
|
2753
|
-
* The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It
|
|
2754
|
-
*
|
|
2755
|
-
* 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.
|
|
2756
2764
|
*/
|
|
2757
2765
|
extraFieldInfoZip?: EntryExtraFieldUnix;
|
|
2758
2766
|
/**
|
|
@@ -2784,8 +2792,8 @@ export interface EntryMetaData {
|
|
|
2784
2792
|
*
|
|
2785
2793
|
* The local file header is the only place where the Info-ZIP Unix extra fields type 1 (0x5855) and type 2
|
|
2786
2794
|
* (0x7855) store the uid/gid, so this is where they are read for entries carrying just these fields, e.g.
|
|
2787
|
-
* with `entry.localDirectory.extraFieldUnixType1.uid`. The values
|
|
2788
|
-
* {@link EntryMetaData#
|
|
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}.
|
|
2789
2797
|
*/
|
|
2790
2798
|
localDirectory?: LocalDirectory;
|
|
2791
2799
|
/**
|
|
@@ -3648,8 +3656,10 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3648
3656
|
* Which Unix extra field format to write when creating entries that include Unix metadata.
|
|
3649
3657
|
* - "infozip": Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid up to 32 bits.
|
|
3650
3658
|
* - "unix": Info-ZIP Unix extra field type 2 (0x7855), storing fixed 2-byte uid/gid (0..65535); a
|
|
3651
|
-
* larger uid or gid is rejected. The
|
|
3652
|
-
*
|
|
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.
|
|
3653
3663
|
*
|
|
3654
3664
|
* When {@link ZipFS} exports imported entries, their uid/gid are re-emitted as "infozip" regardless
|
|
3655
3665
|
* of the field type found in the imported zip file, unless this option is set explicitly.
|
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
|
-
* @
|
|
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
|
-
* @
|
|
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
|
|
1767
|
-
*
|
|
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
|
|
@@ -2240,8 +2247,8 @@ export interface LocalDataDescriptor {
|
|
|
2240
2247
|
* `true` if the record is preceded by its optional signature.
|
|
2241
2248
|
*
|
|
2242
2249
|
* The signature is not part of the original format, it is a later convention writers are free to follow. It is
|
|
2243
|
-
*
|
|
2244
|
-
*
|
|
2250
|
+
* `false` when the record is read as starting at its first byte, see {@link LocalDataDescriptor#zip64} for how the
|
|
2251
|
+
* layout is chosen.
|
|
2245
2252
|
*/
|
|
2246
2253
|
signature: boolean;
|
|
2247
2254
|
/**
|
|
@@ -2251,9 +2258,10 @@ export interface LocalDataDescriptor {
|
|
|
2251
2258
|
* sizes, and the Zip64 extra field of the central directory record, written last, describes that record, not the
|
|
2252
2259
|
* descriptor, so e.g. an entry placed past 4 GB can carry a Zip64 extra field in its central directory record for
|
|
2253
2260
|
* its offset alone and a descriptor with 4-byte sizes. The record is therefore read with the layout, among the two
|
|
2254
|
-
* widths with and without the signature, whose
|
|
2255
|
-
*
|
|
2256
|
-
* the signature
|
|
2261
|
+
* widths with and without the signature, whose sizes agree with the central directory, its CRC-32 too when the
|
|
2262
|
+
* central directory stores one and several layouts qualify; when none does, the width announced by the Zip64 extra
|
|
2263
|
+
* field of the local file header or of the central directory record is used, with the signature when the record
|
|
2264
|
+
* starts with one.
|
|
2257
2265
|
*/
|
|
2258
2266
|
zip64: boolean;
|
|
2259
2267
|
/**
|
|
@@ -2377,13 +2385,13 @@ export interface LocalDirectory {
|
|
|
2377
2385
|
extraFieldNTFS?: EntryExtraFieldNTFS;
|
|
2378
2386
|
/**
|
|
2379
2387
|
* The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
|
|
2380
|
-
* 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).
|
|
2381
2390
|
*/
|
|
2382
2391
|
extraFieldUnix?: EntryExtraFieldUnix;
|
|
2383
2392
|
/**
|
|
2384
|
-
* The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It
|
|
2385
|
-
*
|
|
2386
|
-
* 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.
|
|
2387
2395
|
*/
|
|
2388
2396
|
extraFieldInfoZip?: EntryExtraFieldUnix;
|
|
2389
2397
|
/**
|
|
@@ -2746,13 +2754,13 @@ export interface EntryMetaData {
|
|
|
2746
2754
|
extraFieldNTFS?: EntryExtraFieldNTFS;
|
|
2747
2755
|
/**
|
|
2748
2756
|
* The Info-ZIP Unix type 2 extra field (0x7855). Its uid/gid are stored in the local file header only, the
|
|
2749
|
-
* 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).
|
|
2750
2759
|
*/
|
|
2751
2760
|
extraFieldUnix?: EntryExtraFieldUnix;
|
|
2752
2761
|
/**
|
|
2753
|
-
* The Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid in both headers. It
|
|
2754
|
-
*
|
|
2755
|
-
* 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.
|
|
2756
2764
|
*/
|
|
2757
2765
|
extraFieldInfoZip?: EntryExtraFieldUnix;
|
|
2758
2766
|
/**
|
|
@@ -2784,8 +2792,8 @@ export interface EntryMetaData {
|
|
|
2784
2792
|
*
|
|
2785
2793
|
* The local file header is the only place where the Info-ZIP Unix extra fields type 1 (0x5855) and type 2
|
|
2786
2794
|
* (0x7855) store the uid/gid, so this is where they are read for entries carrying just these fields, e.g.
|
|
2787
|
-
* with `entry.localDirectory.extraFieldUnixType1.uid`. The values
|
|
2788
|
-
* {@link EntryMetaData#
|
|
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}.
|
|
2789
2797
|
*/
|
|
2790
2798
|
localDirectory?: LocalDirectory;
|
|
2791
2799
|
/**
|
|
@@ -3648,8 +3656,10 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3648
3656
|
* Which Unix extra field format to write when creating entries that include Unix metadata.
|
|
3649
3657
|
* - "infozip": Info-ZIP New Unix extra field (0x7875), storing variable-length uid/gid up to 32 bits.
|
|
3650
3658
|
* - "unix": Info-ZIP Unix extra field type 2 (0x7855), storing fixed 2-byte uid/gid (0..65535); a
|
|
3651
|
-
* larger uid or gid is rejected. The
|
|
3652
|
-
*
|
|
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.
|
|
3653
3663
|
*
|
|
3654
3664
|
* When {@link ZipFS} exports imported entries, their uid/gid are re-emitted as "infozip" regardless
|
|
3655
3665
|
* of the field type found in the imported zip file, unless this option is set explicitly.
|