@zip.js/zip.js 2.7.49 → 2.7.51
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/deno.json +1 -1
- package/dist/zip-fs-full.js +22 -14
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +22 -14
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +14 -11
- 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 +14 -11
- package/dist/zip.min.js +1 -1
- package/index.cjs +22 -14
- package/index.min.js +1 -1
- package/lib/core/zip-entry.js +11 -4
- package/lib/core/zip-fs-core.js +8 -3
- package/lib/core/zip-writer.js +10 -6
- package/package.json +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -3347,16 +3347,19 @@
|
|
|
3347
3347
|
const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE = "externalFileAttribute";
|
|
3348
3348
|
const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
|
|
3349
3349
|
const PROPERTY_NAME_ZIP64 = "zip64";
|
|
3350
|
+
const PROPERTY_NAME_ENCRYPTED = "encrypted";
|
|
3351
|
+
const PROPERTY_NAME_VERSION = "version";
|
|
3352
|
+
const PROPERTY_NAME_VERSION_MADE_BY = "versionMadeBy";
|
|
3353
|
+
const PROPERTY_NAME_ZIPCRYPTO = "zipCrypto";
|
|
3350
3354
|
|
|
3351
3355
|
const PROPERTY_NAMES = [
|
|
3352
3356
|
PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, PROPERTY_NAME_COMPPRESSED_SIZE, PROPERTY_NAME_UNCOMPPRESSED_SIZE,
|
|
3353
3357
|
PROPERTY_NAME_LAST_MODIFICATION_DATE, PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT,
|
|
3354
3358
|
PROPERTY_NAME_LAST_ACCESS_DATE, PROPERTY_NAME_CREATION_DATE, PROPERTY_NAME_OFFSET, PROPERTY_NAME_DISK_NUMBER_START,
|
|
3355
3359
|
PROPERTY_NAME_DISK_NUMBER_START, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE,
|
|
3356
|
-
PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64,
|
|
3357
|
-
"directory", "bitFlag", "
|
|
3358
|
-
"
|
|
3359
|
-
"extraFieldExtendedTimestamp", "zipCrypto"];
|
|
3360
|
+
PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64, PROPERTY_NAME_ENCRYPTED, PROPERTY_NAME_VERSION, PROPERTY_NAME_VERSION_MADE_BY,
|
|
3361
|
+
PROPERTY_NAME_ZIPCRYPTO, "directory", "bitFlag", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "extraField", "rawExtraField",
|
|
3362
|
+
"extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS", "extraFieldExtendedTimestamp"];
|
|
3360
3363
|
|
|
3361
3364
|
class Entry {
|
|
3362
3365
|
|
|
@@ -4100,7 +4103,7 @@
|
|
|
4100
4103
|
config: getConfiguration(),
|
|
4101
4104
|
files: new Map(),
|
|
4102
4105
|
filenames: new Set(),
|
|
4103
|
-
offset: writer.writable.size,
|
|
4106
|
+
offset: options.offset === UNDEFINED_VALUE ? writer.writable.size : options.offset,
|
|
4104
4107
|
pendingEntriesSize: 0,
|
|
4105
4108
|
pendingAddFileCalls: new Set(),
|
|
4106
4109
|
bufferedWrites: 0
|
|
@@ -4208,11 +4211,11 @@
|
|
|
4208
4211
|
if (getLength(rawComment) > MAX_16_BITS) {
|
|
4209
4212
|
throw new Error(ERR_INVALID_ENTRY_COMMENT);
|
|
4210
4213
|
}
|
|
4211
|
-
const version = getOptionValue(zipWriter, options,
|
|
4214
|
+
const version = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION, VERSION_DEFLATE);
|
|
4212
4215
|
if (version > MAX_16_BITS) {
|
|
4213
4216
|
throw new Error(ERR_INVALID_VERSION);
|
|
4214
4217
|
}
|
|
4215
|
-
const versionMadeBy = getOptionValue(zipWriter, options,
|
|
4218
|
+
const versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, 20);
|
|
4216
4219
|
if (versionMadeBy > MAX_16_BITS) {
|
|
4217
4220
|
throw new Error(ERR_INVALID_VERSION);
|
|
4218
4221
|
}
|
|
@@ -4229,7 +4232,7 @@
|
|
|
4229
4232
|
rawPassword = getOptionValue(zipWriter, options, "rawPassword");
|
|
4230
4233
|
}
|
|
4231
4234
|
const encryptionStrength = getOptionValue(zipWriter, options, "encryptionStrength", 3);
|
|
4232
|
-
const zipCrypto = getOptionValue(zipWriter, options,
|
|
4235
|
+
const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
|
|
4233
4236
|
const extendedTimestamp = getOptionValue(zipWriter, options, "extendedTimestamp", true);
|
|
4234
4237
|
const keepOrder = getOptionValue(zipWriter, options, "keepOrder", true);
|
|
4235
4238
|
const level = getOptionValue(zipWriter, options, "level");
|
|
@@ -4241,7 +4244,7 @@
|
|
|
4241
4244
|
const useCompressionStream = getOptionValue(zipWriter, options, "useCompressionStream");
|
|
4242
4245
|
let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor", true);
|
|
4243
4246
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
4244
|
-
if ((password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) &&
|
|
4247
|
+
if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
|
|
4245
4248
|
throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
|
|
4246
4249
|
}
|
|
4247
4250
|
let rawExtraField = new Uint8Array();
|
|
@@ -4306,7 +4309,7 @@
|
|
|
4306
4309
|
}
|
|
4307
4310
|
}
|
|
4308
4311
|
zip64 = zip64 || false;
|
|
4309
|
-
const encrypted = getOptionValue(zipWriter, options,
|
|
4312
|
+
const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
|
|
4310
4313
|
const { signature } = options;
|
|
4311
4314
|
options = Object.assign({}, options, {
|
|
4312
4315
|
rawFilename,
|
|
@@ -5082,7 +5085,7 @@
|
|
|
5082
5085
|
if (availableSize < END_OF_CENTRAL_DIR_LENGTH) {
|
|
5083
5086
|
lastDiskNumber++;
|
|
5084
5087
|
}
|
|
5085
|
-
let zip64 = getOptionValue(zipWriter, options,
|
|
5088
|
+
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
5086
5089
|
if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
|
|
5087
5090
|
if (zip64 === false) {
|
|
5088
5091
|
throw new Error(ERR_UNSUPPORTED_FORMAT);
|
|
@@ -5907,12 +5910,16 @@
|
|
|
5907
5910
|
encrypted,
|
|
5908
5911
|
zipCrypto,
|
|
5909
5912
|
signature,
|
|
5910
|
-
compressionMethod
|
|
5913
|
+
compressionMethod,
|
|
5914
|
+
extraFieldAES
|
|
5911
5915
|
} = child.data;
|
|
5912
|
-
let level;
|
|
5916
|
+
let level, encryptionStrength;
|
|
5913
5917
|
if (compressionMethod === 0) {
|
|
5914
5918
|
level = 0;
|
|
5915
5919
|
}
|
|
5920
|
+
if (extraFieldAES) {
|
|
5921
|
+
encryptionStrength = extraFieldAES.strength;
|
|
5922
|
+
}
|
|
5916
5923
|
zipEntryOptions = {
|
|
5917
5924
|
externalFileAttribute,
|
|
5918
5925
|
versionMadeBy,
|
|
@@ -5928,7 +5935,8 @@
|
|
|
5928
5935
|
zipCrypto,
|
|
5929
5936
|
signature,
|
|
5930
5937
|
uncompressedSize,
|
|
5931
|
-
level
|
|
5938
|
+
level,
|
|
5939
|
+
encryptionStrength
|
|
5932
5940
|
});
|
|
5933
5941
|
}
|
|
5934
5942
|
}
|