@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.js
CHANGED
|
@@ -3690,6 +3690,7 @@
|
|
|
3690
3690
|
const dataView = getDataView$1(dataArray);
|
|
3691
3691
|
let password = getOptionValue$1(zipEntry, options, "password");
|
|
3692
3692
|
let rawPassword = getOptionValue$1(zipEntry, options, "rawPassword");
|
|
3693
|
+
const passThrough = getOptionValue$1(zipEntry, options, "passThrough");
|
|
3693
3694
|
password = password && password.length && password;
|
|
3694
3695
|
rawPassword = rawPassword && rawPassword.length && rawPassword;
|
|
3695
3696
|
if (extraFieldAES) {
|
|
@@ -3697,7 +3698,7 @@
|
|
|
3697
3698
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
3698
3699
|
}
|
|
3699
3700
|
}
|
|
3700
|
-
if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {
|
|
3701
|
+
if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) && !passThrough) {
|
|
3701
3702
|
throw new Error(ERR_UNSUPPORTED_COMPRESSION);
|
|
3702
3703
|
}
|
|
3703
3704
|
if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
|
|
@@ -3712,7 +3713,6 @@
|
|
|
3712
3713
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
3713
3714
|
creationDate: localDirectory.creationDate
|
|
3714
3715
|
});
|
|
3715
|
-
const passThrough = getOptionValue$1(zipEntry, options, "passThrough");
|
|
3716
3716
|
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
|
|
3717
3717
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
3718
3718
|
if (!passThrough) {
|
|
@@ -3739,7 +3739,7 @@
|
|
|
3739
3739
|
writer = new WritableStream();
|
|
3740
3740
|
}
|
|
3741
3741
|
writer = initWriter(writer);
|
|
3742
|
-
await initStream(writer, uncompressedSize);
|
|
3742
|
+
await initStream(writer, passThrough ? compressedSize : uncompressedSize);
|
|
3743
3743
|
const { writable } = writer;
|
|
3744
3744
|
const { onstart, onprogress, onend } = options;
|
|
3745
3745
|
const workerOptions = {
|
|
@@ -4242,6 +4242,7 @@
|
|
|
4242
4242
|
const signal = getOptionValue(zipWriter, options, "signal");
|
|
4243
4243
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, "useUnicodeFileNames", true);
|
|
4244
4244
|
const useCompressionStream = getOptionValue(zipWriter, options, "useCompressionStream");
|
|
4245
|
+
const compressionMethod = getOptionValue(zipWriter, options, "compressionMethod");
|
|
4245
4246
|
let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor", true);
|
|
4246
4247
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
4247
4248
|
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
@@ -4344,7 +4345,8 @@
|
|
|
4344
4345
|
useCompressionStream,
|
|
4345
4346
|
passThrough,
|
|
4346
4347
|
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
|
|
4347
|
-
signature
|
|
4348
|
+
signature,
|
|
4349
|
+
compressionMethod
|
|
4348
4350
|
});
|
|
4349
4351
|
const headerInfo = getHeaderInfo(options);
|
|
4350
4352
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
@@ -4692,7 +4694,7 @@
|
|
|
4692
4694
|
encrypted
|
|
4693
4695
|
} = options;
|
|
4694
4696
|
const compressed = level !== 0 && !directory;
|
|
4695
|
-
let version = options
|
|
4697
|
+
let { version, compressionMethod } = options;
|
|
4696
4698
|
let rawExtraFieldAES;
|
|
4697
4699
|
if (encrypted && !zipCrypto) {
|
|
4698
4700
|
rawExtraFieldAES = new Uint8Array(getLength(EXTRAFIELD_DATA_AES) + 2);
|
|
@@ -4747,9 +4749,10 @@
|
|
|
4747
4749
|
if (dataDescriptor) {
|
|
4748
4750
|
bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
|
|
4749
4751
|
}
|
|
4750
|
-
|
|
4752
|
+
if (compressionMethod === UNDEFINED_VALUE) {
|
|
4753
|
+
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
4754
|
+
}
|
|
4751
4755
|
if (compressed) {
|
|
4752
|
-
compressionMethod = COMPRESSION_METHOD_DEFLATE;
|
|
4753
4756
|
if (level >= 1 && level < 3) {
|
|
4754
4757
|
bitFlag = bitFlag | 0b110;
|
|
4755
4758
|
}
|
|
@@ -4767,10 +4770,8 @@
|
|
|
4767
4770
|
bitFlag = bitFlag | BITFLAG_ENCRYPTED;
|
|
4768
4771
|
if (!zipCrypto) {
|
|
4769
4772
|
version = version > VERSION_AES ? version : VERSION_AES;
|
|
4773
|
+
rawExtraFieldAES[9] = compressionMethod;
|
|
4770
4774
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
4771
|
-
if (compressed) {
|
|
4772
|
-
rawExtraFieldAES[9] = COMPRESSION_METHOD_DEFLATE;
|
|
4773
|
-
}
|
|
4774
4775
|
}
|
|
4775
4776
|
}
|
|
4776
4777
|
const headerArray = new Uint8Array(26);
|
|
@@ -5913,13 +5914,6 @@
|
|
|
5913
5914
|
compressionMethod,
|
|
5914
5915
|
extraFieldAES
|
|
5915
5916
|
} = child.data;
|
|
5916
|
-
let level, encryptionStrength;
|
|
5917
|
-
if (compressionMethod === 0) {
|
|
5918
|
-
level = 0;
|
|
5919
|
-
}
|
|
5920
|
-
if (extraFieldAES) {
|
|
5921
|
-
encryptionStrength = extraFieldAES.strength;
|
|
5922
|
-
}
|
|
5923
5917
|
zipEntryOptions = {
|
|
5924
5918
|
externalFileAttribute,
|
|
5925
5919
|
versionMadeBy,
|
|
@@ -5929,6 +5923,13 @@
|
|
|
5929
5923
|
lastAccessDate
|
|
5930
5924
|
};
|
|
5931
5925
|
if (child.passThrough) {
|
|
5926
|
+
let level, encryptionStrength;
|
|
5927
|
+
if (compressionMethod === 0) {
|
|
5928
|
+
level = 0;
|
|
5929
|
+
}
|
|
5930
|
+
if (extraFieldAES) {
|
|
5931
|
+
encryptionStrength = extraFieldAES.strength;
|
|
5932
|
+
}
|
|
5932
5933
|
zipEntryOptions = Object.assign(zipEntryOptions, {
|
|
5933
5934
|
passThrough: true,
|
|
5934
5935
|
encrypted,
|
|
@@ -5936,7 +5937,8 @@
|
|
|
5936
5937
|
signature,
|
|
5937
5938
|
uncompressedSize,
|
|
5938
5939
|
level,
|
|
5939
|
-
encryptionStrength
|
|
5940
|
+
encryptionStrength,
|
|
5941
|
+
compressionMethod
|
|
5940
5942
|
});
|
|
5941
5943
|
}
|
|
5942
5944
|
}
|