@zip.js/zip.js 2.7.51 → 2.7.52
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/dist/zip-fs-full.js +20 -18
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +20 -18
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +11 -10
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +11 -10
- package/dist/zip.min.js +1 -1
- package/index.cjs +20 -18
- package/index.d.ts +11 -3
- package/index.min.js +1 -1
- package/lib/core/zip-fs-core.js +9 -8
- package/lib/core/zip-reader.js +3 -3
- package/lib/core/zip-writer.js +8 -7
- package/package.json +1 -1
package/dist/zip-fs-full.js
CHANGED
|
@@ -9545,6 +9545,7 @@
|
|
|
9545
9545
|
const dataView = getDataView$1(dataArray);
|
|
9546
9546
|
let password = getOptionValue$1(zipEntry, options, "password");
|
|
9547
9547
|
let rawPassword = getOptionValue$1(zipEntry, options, "rawPassword");
|
|
9548
|
+
const passThrough = getOptionValue$1(zipEntry, options, "passThrough");
|
|
9548
9549
|
password = password && password.length && password;
|
|
9549
9550
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
9550
9551
|
if (extraFieldAES) {
|
|
@@ -9552,7 +9553,7 @@
|
|
|
9552
9553
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
9553
9554
|
}
|
|
9554
9555
|
}
|
|
9555
|
-
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {
|
|
9556
|
+
if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) && !passThrough) {
|
|
9556
9557
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
9557
9558
|
}
|
|
9558
9559
|
if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
|
|
@@ -9567,7 +9568,6 @@
|
|
|
9567
9568
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
9568
9569
|
creationDate: localDirectory.creationDate
|
|
9569
9570
|
});
|
|
9570
|
-
const passThrough = getOptionValue$1(zipEntry, options, "passThrough");
|
|
9571
9571
|
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
|
|
9572
9572
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
9573
9573
|
if (!passThrough) {
|
|
@@ -9594,7 +9594,7 @@
|
|
|
9594
9594
|
writer = new WritableStream();
|
|
9595
9595
|
}
|
|
9596
9596
|
writer = initWriter(writer);
|
|
9597
|
-
await initStream(writer, uncompressedSize);
|
|
9597
|
+
await initStream(writer, passThrough ? compressedSize : uncompressedSize);
|
|
9598
9598
|
const { writable } = writer;
|
|
9599
9599
|
const { onstart, onprogress, onend } = options;
|
|
9600
9600
|
const workerOptions = {
|
|
@@ -10097,6 +10097,7 @@
|
|
|
10097
10097
|
const signal = getOptionValue(zipWriter, options, "signal");
|
|
10098
10098
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, "useUnicodeFileNames", true);
|
|
10099
10099
|
const useCompressionStream = getOptionValue(zipWriter, options, "useCompressionStream");
|
|
10100
|
+
const compressionMethod = getOptionValue(zipWriter, options, "compressionMethod");
|
|
10100
10101
|
let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor", true);
|
|
10101
10102
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
10102
10103
|
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
@@ -10199,7 +10200,8 @@
|
|
|
10199
10200
|
useCompressionStream,
|
|
10200
10201
|
passThrough,
|
|
10201
10202
|
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
|
|
10202
|
-
signature
|
|
10203
|
+
signature,
|
|
10204
|
+
compressionMethod
|
|
10203
10205
|
});
|
|
10204
10206
|
const headerInfo = getHeaderInfo(options);
|
|
10205
10207
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
@@ -10547,7 +10549,7 @@
|
|
|
10547
10549
|
encrypted
|
|
10548
10550
|
} = options;
|
|
10549
10551
|
const compressed = level !== 0 && !directory;
|
|
10550
|
-
let version = options
|
|
10552
|
+
let { version, compressionMethod } = options;
|
|
10551
10553
|
let rawExtraFieldAES;
|
|
10552
10554
|
if (encrypted && !zipCrypto) {
|
|
10553
10555
|
rawExtraFieldAES = new Uint8Array(getLength(EXTRAFIELD_DATA_AES) + 2);
|
|
@@ -10602,9 +10604,10 @@
|
|
|
10602
10604
|
if (dataDescriptor) {
|
|
10603
10605
|
bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
|
|
10604
10606
|
}
|
|
10605
|
-
|
|
10607
|
+
if (compressionMethod === UNDEFINED_VALUE) {
|
|
10608
|
+
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
10609
|
+
}
|
|
10606
10610
|
if (compressed) {
|
|
10607
|
-
compressionMethod = COMPRESSION_METHOD_DEFLATE;
|
|
10608
10611
|
if (level >= 1 && level < 3) {
|
|
10609
10612
|
bitFlag = bitFlag | 0b110;
|
|
10610
10613
|
}
|
|
@@ -10622,10 +10625,8 @@
|
|
|
10622
10625
|
bitFlag = bitFlag | BITFLAG_ENCRYPTED;
|
|
10623
10626
|
if (!zipCrypto) {
|
|
10624
10627
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
10628
|
+
rawExtraFieldAES[9] = compressionMethod;
|
|
10625
10629
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
10626
|
-
if (compressed) {
|
|
10627
|
-
rawExtraFieldAES[9] = COMPRESSION_METHOD_DEFLATE;
|
|
10628
|
-
}
|
|
10629
10630
|
}
|
|
10630
10631
|
}
|
|
10631
10632
|
const headerArray = new Uint8Array(26);
|
|
@@ -11768,13 +11769,6 @@
|
|
|
11768
11769
|
compressionMethod,
|
|
11769
11770
|
extraFieldAES
|
|
11770
11771
|
} = child.data;
|
|
11771
|
-
let level, encryptionStrength;
|
|
11772
|
-
if (compressionMethod === 0) {
|
|
11773
|
-
level = 0;
|
|
11774
|
-
}
|
|
11775
|
-
if (extraFieldAES) {
|
|
11776
|
-
encryptionStrength = extraFieldAES.strength;
|
|
11777
|
-
}
|
|
11778
11772
|
zipEntryOptions = {
|
|
11779
11773
|
externalFileAttribute,
|
|
11780
11774
|
versionMadeBy,
|
|
@@ -11784,6 +11778,13 @@
|
|
|
11784
11778
|
lastAccessDate
|
|
11785
11779
|
};
|
|
11786
11780
|
if (child.passThrough) {
|
|
11781
|
+
let level, encryptionStrength;
|
|
11782
|
+
if (compressionMethod === 0) {
|
|
11783
|
+
level = 0;
|
|
11784
|
+
}
|
|
11785
|
+
if (extraFieldAES) {
|
|
11786
|
+
encryptionStrength = extraFieldAES.strength;
|
|
11787
|
+
}
|
|
11787
11788
|
zipEntryOptions = Object.assign(zipEntryOptions, {
|
|
11788
11789
|
passThrough: true,
|
|
11789
11790
|
encrypted,
|
|
@@ -11791,7 +11792,8 @@
|
|
|
11791
11792
|
signature,
|
|
11792
11793
|
uncompressedSize,
|
|
11793
11794
|
level,
|
|
11794
|
-
encryptionStrength
|
|
11795
|
+
encryptionStrength,
|
|
11796
|
+
compressionMethod
|
|
11795
11797
|
});
|
|
11796
11798
|
}
|
|
11797
11799
|
}
|