@zip.js/zip.js 2.11.2 → 2.11.4
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 +146 -38
- package/deno.json +1 -1
- package/dist/zip-core-external.js +80 -36
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +82 -36
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +87 -41
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +89 -41
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +87 -41
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +89 -41
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +89 -41
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +82 -36
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +82 -36
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +82 -36
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +88 -40
- package/index-native.min.js +1 -1
- package/index.cjs +88 -40
- package/index.d.cts +39 -2
- package/index.d.ts +39 -2
- package/index.min.js +1 -1
- package/lib/core/io.js +7 -5
- package/lib/core/options.js +13 -0
- package/lib/core/version.js +1 -1
- package/lib/core/zip-fs.js +5 -5
- package/lib/core/zip-reader.js +20 -17
- package/lib/core/zip-writer.js +50 -13
- package/lib/zip-core-writer.js +2 -0
- package/package.json +1 -1
package/dist/zip-fs-core.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zip = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker, Symbol, setTimeout, clearTimeout, structuredClone } = typeof globalThis !== 'undefined' ? globalThis :
|
|
7
|
+
const { Array, Object, String, Number, BigInt, Math, Date, Map, Set, Response, URL, Error, Uint8Array, Uint16Array, Uint32Array, DataView, Blob, Promise, TextEncoder, TextDecoder, document, crypto, btoa, TransformStream, ReadableStream, WritableStream, CompressionStream, DecompressionStream, navigator, Worker, Symbol, setTimeout, clearTimeout, structuredClone } = typeof globalThis !== 'undefined' ? globalThis : self;
|
|
8
8
|
|
|
9
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
10
|
/*
|
|
@@ -217,6 +217,8 @@
|
|
|
217
217
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
218
218
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
219
219
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
220
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
221
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
220
222
|
|
|
221
223
|
function checkFunctionOption(value) {
|
|
222
224
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -232,6 +234,12 @@
|
|
|
232
234
|
return signal || UNDEFINED_VALUE;
|
|
233
235
|
}
|
|
234
236
|
|
|
237
|
+
function throwIfAborted(signal) {
|
|
238
|
+
if (signal && signal.aborted) {
|
|
239
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
235
243
|
function checkPasswordOption(password, rawPassword) {
|
|
236
244
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
237
245
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3754,11 +3762,13 @@
|
|
|
3754
3762
|
const reader = this;
|
|
3755
3763
|
const { sourceBlob, size } = reader;
|
|
3756
3764
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3757
|
-
if (
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3765
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3766
|
+
if (!offset && readSize >= size) {
|
|
3767
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3768
|
+
}
|
|
3769
|
+
if (blobSliceReliable) {
|
|
3770
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3771
|
+
}
|
|
3762
3772
|
}
|
|
3763
3773
|
return super.createReadable(options);
|
|
3764
3774
|
}
|
|
@@ -5194,27 +5204,28 @@
|
|
|
5194
5204
|
const { done, value } = await gen.next();
|
|
5195
5205
|
if (done)
|
|
5196
5206
|
return controller.close();
|
|
5197
|
-
const
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
return readable;
|
|
5204
|
-
}
|
|
5207
|
+
const entryReadable = (function () {
|
|
5208
|
+
const { readable, writable } = new TransformStream();
|
|
5209
|
+
if (value.getData) {
|
|
5210
|
+
getData();
|
|
5211
|
+
return readable;
|
|
5212
|
+
}
|
|
5205
5213
|
|
|
5206
|
-
|
|
5214
|
+
async function getData() {
|
|
5215
|
+
try {
|
|
5216
|
+
await value.getData(writable);
|
|
5217
|
+
} catch (error) {
|
|
5207
5218
|
try {
|
|
5208
|
-
await
|
|
5209
|
-
} catch
|
|
5210
|
-
|
|
5211
|
-
await writable.abort(error);
|
|
5212
|
-
} catch {
|
|
5213
|
-
// ignored
|
|
5214
|
-
}
|
|
5219
|
+
await writable.abort(error);
|
|
5220
|
+
} catch {
|
|
5221
|
+
// ignored
|
|
5215
5222
|
}
|
|
5216
5223
|
}
|
|
5217
|
-
}
|
|
5224
|
+
}
|
|
5225
|
+
})();
|
|
5226
|
+
const chunk = {
|
|
5227
|
+
...value,
|
|
5228
|
+
readable: entryReadable
|
|
5218
5229
|
};
|
|
5219
5230
|
delete chunk.getData;
|
|
5220
5231
|
controller.enqueue(chunk);
|
|
@@ -5360,6 +5371,7 @@
|
|
|
5360
5371
|
const size = compressedSize;
|
|
5361
5372
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5362
5373
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5374
|
+
throwIfAborted(signal);
|
|
5363
5375
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5364
5376
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5365
5377
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6266,6 +6278,7 @@
|
|
|
6266
6278
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
6267
6279
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6268
6280
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6281
|
+
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6269
6282
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6270
6283
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6271
6284
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
@@ -6280,6 +6293,7 @@
|
|
|
6280
6293
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6281
6294
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6282
6295
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6296
|
+
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
6283
6297
|
const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
|
|
6284
6298
|
const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
|
|
6285
6299
|
const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
|
|
@@ -6311,6 +6325,9 @@
|
|
|
6311
6325
|
const addSplitZipSignature =
|
|
6312
6326
|
availableSize > 0 && availableSize !== INFINITY_VALUE &&
|
|
6313
6327
|
maxSize > 0 && maxSize !== INFINITY_VALUE;
|
|
6328
|
+
if (addSplitZipSignature && options[OPTION_USDZ]) {
|
|
6329
|
+
throw new Error(ERR_UNSUPPORTED_SPLIT_USDZ);
|
|
6330
|
+
}
|
|
6314
6331
|
Object.assign(this, {
|
|
6315
6332
|
writer,
|
|
6316
6333
|
addSplitZipSignature,
|
|
@@ -6426,6 +6443,7 @@
|
|
|
6426
6443
|
}
|
|
6427
6444
|
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6428
6445
|
Object.assign(entry, {
|
|
6446
|
+
zip64Enabled: true,
|
|
6429
6447
|
zip64UncompressedSize,
|
|
6430
6448
|
zip64CompressedSize,
|
|
6431
6449
|
offset,
|
|
@@ -6884,6 +6902,7 @@
|
|
|
6884
6902
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6885
6903
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6886
6904
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6905
|
+
throwIfAborted(signal);
|
|
6887
6906
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6888
6907
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6889
6908
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -7001,6 +7020,9 @@
|
|
|
7001
7020
|
if (reader) {
|
|
7002
7021
|
reader = new GenericReader(reader);
|
|
7003
7022
|
await initStream(reader);
|
|
7023
|
+
if (!reader.readable && !reader.readUint8Array) {
|
|
7024
|
+
throw new Error(ERR_INVALID_READER);
|
|
7025
|
+
}
|
|
7004
7026
|
({ size: contentSize } = reader);
|
|
7005
7027
|
}
|
|
7006
7028
|
return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
|
|
@@ -7011,6 +7033,7 @@
|
|
|
7011
7033
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7012
7034
|
let maximumCompressedSize = 0;
|
|
7013
7035
|
let uncompressedSize = 0;
|
|
7036
|
+
let unknownSize = false;
|
|
7014
7037
|
if (passThrough && hasContent) {
|
|
7015
7038
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7016
7039
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
@@ -7036,8 +7059,8 @@
|
|
|
7036
7059
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7037
7060
|
dataDescriptor = true;
|
|
7038
7061
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
7039
|
-
zip64 = true;
|
|
7040
|
-
|
|
7062
|
+
zip64 = unknownSize = true;
|
|
7063
|
+
maximumCompressedSize = MAX_32_BITS + 1;
|
|
7041
7064
|
}
|
|
7042
7065
|
} else {
|
|
7043
7066
|
options.uncompressedSize = uncompressedSize = contentSize;
|
|
@@ -7052,7 +7075,7 @@
|
|
|
7052
7075
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7053
7076
|
dataDescriptor = false;
|
|
7054
7077
|
}
|
|
7055
|
-
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
7078
|
+
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
7056
7079
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
7057
7080
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
7058
7081
|
if (zip64 === false) {
|
|
@@ -7068,6 +7091,8 @@
|
|
|
7068
7091
|
dataDescriptor,
|
|
7069
7092
|
emptyEntry,
|
|
7070
7093
|
zip64,
|
|
7094
|
+
zip64Enabled,
|
|
7095
|
+
unknownSize,
|
|
7071
7096
|
zip64UncompressedSize,
|
|
7072
7097
|
zip64CompressedSize,
|
|
7073
7098
|
uncompressedSize,
|
|
@@ -7141,7 +7166,7 @@
|
|
|
7141
7166
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7142
7167
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7143
7168
|
}
|
|
7144
|
-
const directoryDataLength = createDirectoryRecords(files);
|
|
7169
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(files);
|
|
7145
7170
|
let zip64 = getOptionValue(zipWriter, writerOptions, PROPERTY_NAME_ZIP64);
|
|
7146
7171
|
if (offset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || files.size >= MAX_16_BITS) {
|
|
7147
7172
|
if (zip64 === false) {
|
|
@@ -7149,6 +7174,8 @@
|
|
|
7149
7174
|
} else {
|
|
7150
7175
|
zip64 = true;
|
|
7151
7176
|
}
|
|
7177
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
7178
|
+
zip64 = true;
|
|
7152
7179
|
}
|
|
7153
7180
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7154
7181
|
}
|
|
@@ -7341,6 +7368,7 @@
|
|
|
7341
7368
|
rawPassword,
|
|
7342
7369
|
level,
|
|
7343
7370
|
zip64,
|
|
7371
|
+
zip64Enabled,
|
|
7344
7372
|
zip64UncompressedSize,
|
|
7345
7373
|
zip64CompressedSize,
|
|
7346
7374
|
zipCrypto,
|
|
@@ -7381,6 +7409,7 @@
|
|
|
7381
7409
|
lockFileEntry,
|
|
7382
7410
|
versionMadeBy,
|
|
7383
7411
|
zip64,
|
|
7412
|
+
zip64Enabled,
|
|
7384
7413
|
directory: Boolean(directory),
|
|
7385
7414
|
executable: Boolean(executable),
|
|
7386
7415
|
filenameUTF8: true,
|
|
@@ -7524,13 +7553,14 @@
|
|
|
7524
7553
|
zip64UncompressedSize,
|
|
7525
7554
|
zip64CompressedSize,
|
|
7526
7555
|
uncompressedSize,
|
|
7556
|
+
unknownSize,
|
|
7527
7557
|
crc32
|
|
7528
7558
|
} = options;
|
|
7529
7559
|
let { version, compressionMethod } = options;
|
|
7530
7560
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7531
7561
|
let rawLocalExtraFieldZip64;
|
|
7532
7562
|
const uncompressedFile = passThrough || !compressed;
|
|
7533
|
-
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
7563
|
+
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7534
7564
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7535
7565
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
7536
7566
|
const length = 4 + 16;
|
|
@@ -7664,6 +7694,10 @@
|
|
|
7664
7694
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
7665
7695
|
}
|
|
7666
7696
|
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7697
|
+
const clampedLastModDate = dosLastModDate < MIN_DATE ? MIN_DATE : dosLastModDate > MAX_DATE ? MAX_DATE : dosLastModDate;
|
|
7698
|
+
const storedLastModDate = getLength(rawExtraFieldExtendedTimestamp) ?
|
|
7699
|
+
new Date(getTimeUnix(lastModDate) * 1000) :
|
|
7700
|
+
getLength(rawExtraFieldNTFS) ? lastModDate : clampedLastModDate;
|
|
7667
7701
|
const {
|
|
7668
7702
|
headerArray,
|
|
7669
7703
|
headerView,
|
|
@@ -7673,7 +7707,7 @@
|
|
|
7673
7707
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
7674
7708
|
compressionMethod,
|
|
7675
7709
|
uncompressedSize,
|
|
7676
|
-
lastModDate:
|
|
7710
|
+
lastModDate: clampedLastModDate,
|
|
7677
7711
|
rawLastModDate: rawLastModDateOption,
|
|
7678
7712
|
rawFilename,
|
|
7679
7713
|
zip64CompressedSize,
|
|
@@ -7708,7 +7742,7 @@
|
|
|
7708
7742
|
localHeaderView,
|
|
7709
7743
|
headerArray,
|
|
7710
7744
|
headerView,
|
|
7711
|
-
lastModDate,
|
|
7745
|
+
lastModDate: storedLastModDate,
|
|
7712
7746
|
rawLastModDate,
|
|
7713
7747
|
encrypted,
|
|
7714
7748
|
compressed,
|
|
@@ -7880,14 +7914,15 @@
|
|
|
7880
7914
|
|
|
7881
7915
|
|
|
7882
7916
|
async function closeFile(zipWriter, comment, options) {
|
|
7883
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7917
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(zipWriter.fileEntries);
|
|
7884
7918
|
const { directoryStart, directoryEnd, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7885
7919
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7886
|
-
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength });
|
|
7920
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength, zip64Entries });
|
|
7887
7921
|
}
|
|
7888
7922
|
|
|
7889
7923
|
function createDirectoryRecords(files) {
|
|
7890
7924
|
let directoryDataLength = 0;
|
|
7925
|
+
let zip64Entries = false;
|
|
7891
7926
|
for (const [, fileEntry] of files) {
|
|
7892
7927
|
const {
|
|
7893
7928
|
rawFilename,
|
|
@@ -7900,11 +7935,20 @@
|
|
|
7900
7935
|
extendedTimestamp,
|
|
7901
7936
|
extraFieldExtendedTimestampFlag,
|
|
7902
7937
|
lastModDate,
|
|
7903
|
-
|
|
7904
|
-
zip64CompressedSize,
|
|
7938
|
+
zip64Enabled,
|
|
7905
7939
|
uncompressedSize,
|
|
7906
7940
|
compressedSize
|
|
7907
7941
|
} = fileEntry;
|
|
7942
|
+
let { zip64UncompressedSize, zip64CompressedSize } = fileEntry;
|
|
7943
|
+
if (!zip64Enabled) {
|
|
7944
|
+
if (zip64UncompressedSize && uncompressedSize < MAX_32_BITS) {
|
|
7945
|
+
zip64UncompressedSize = fileEntry.zip64UncompressedSize = false;
|
|
7946
|
+
}
|
|
7947
|
+
if (zip64CompressedSize && compressedSize < MAX_32_BITS) {
|
|
7948
|
+
zip64CompressedSize = fileEntry.zip64CompressedSize = false;
|
|
7949
|
+
}
|
|
7950
|
+
}
|
|
7951
|
+
zip64Entries = zip64Entries || zip64UncompressedSize || zip64CompressedSize;
|
|
7908
7952
|
const zip64Offset = fileEntry.offset >= MAX_32_BITS;
|
|
7909
7953
|
const zip64DiskNumberStart = fileEntry.diskNumberStart >= MAX_16_BITS;
|
|
7910
7954
|
let rawExtraFieldZip64;
|
|
@@ -7958,7 +8002,7 @@
|
|
|
7958
8002
|
}
|
|
7959
8003
|
directoryDataLength += CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
7960
8004
|
}
|
|
7961
|
-
return directoryDataLength;
|
|
8005
|
+
return { directoryDataLength, zip64Entries };
|
|
7962
8006
|
}
|
|
7963
8007
|
|
|
7964
8008
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
@@ -8078,7 +8122,7 @@
|
|
|
8078
8122
|
|
|
8079
8123
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
8080
8124
|
const { writer } = zipWriter;
|
|
8081
|
-
const { directoryStart, directoryEnd, signatureLength } = cdInfo;
|
|
8125
|
+
const { directoryStart, directoryEnd, signatureLength, zip64Entries } = cdInfo;
|
|
8082
8126
|
let { directoryDataLength } = cdInfo;
|
|
8083
8127
|
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
8084
8128
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -8098,6 +8142,8 @@
|
|
|
8098
8142
|
} else {
|
|
8099
8143
|
zip64 = true;
|
|
8100
8144
|
}
|
|
8145
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
8146
|
+
zip64 = true;
|
|
8101
8147
|
}
|
|
8102
8148
|
const endOfdirectoryRecord = createRecordWriter(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
8103
8149
|
if (exceedsAvailableSize(writer, getLength(endOfdirectoryRecord.array) + commentLength)) {
|
|
@@ -8601,7 +8647,7 @@
|
|
|
8601
8647
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8602
8648
|
*/
|
|
8603
8649
|
|
|
8604
|
-
const VERSION = "2.11.
|
|
8650
|
+
const VERSION = "2.11.4";
|
|
8605
8651
|
|
|
8606
8652
|
/*
|
|
8607
8653
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9092,8 +9138,6 @@
|
|
|
9092
9138
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9093
9139
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9094
9140
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9095
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9096
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9097
9141
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9098
9142
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9099
9143
|
EXTRAFIELD_TYPE_ZIP64,
|
|
@@ -9587,12 +9631,14 @@
|
|
|
9587
9631
|
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
9588
9632
|
options.bufferedWrite = true;
|
|
9589
9633
|
}
|
|
9590
|
-
const
|
|
9634
|
+
const children = zipEntry.getChildren({ recursive: true });
|
|
9635
|
+
const entries = children.filter(child => !isImplicitDirectory(child)).map(child => {
|
|
9591
9636
|
const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
|
|
9592
9637
|
return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
|
|
9593
9638
|
});
|
|
9594
9639
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
9595
|
-
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9640
|
+
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
9641
|
+
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
9596
9642
|
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
9597
9643
|
}
|
|
9598
9644
|
|
|
@@ -10526,6 +10572,7 @@
|
|
|
10526
10572
|
exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
|
|
10527
10573
|
exports.ERR_INVALID_PASSWORD_TYPE = ERR_INVALID_PASSWORD_TYPE;
|
|
10528
10574
|
exports.ERR_INVALID_PASS_THROUGH = ERR_INVALID_PASS_THROUGH;
|
|
10575
|
+
exports.ERR_INVALID_READER = ERR_INVALID_READER;
|
|
10529
10576
|
exports.ERR_INVALID_READER_OPTIONS = ERR_INVALID_READER_OPTIONS;
|
|
10530
10577
|
exports.ERR_INVALID_SIGNAL = ERR_INVALID_SIGNAL;
|
|
10531
10578
|
exports.ERR_INVALID_SIGNATURE_DATA = ERR_INVALID_SIGNATURE_DATA;
|
|
@@ -10554,6 +10601,7 @@
|
|
|
10554
10601
|
exports.ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH;
|
|
10555
10602
|
exports.ERR_UNSUPPORTED_ENCRYPTION_USDZ = ERR_UNSUPPORTED_ENCRYPTION_USDZ;
|
|
10556
10603
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
|
10604
|
+
exports.ERR_UNSUPPORTED_SPLIT_USDZ = ERR_UNSUPPORTED_SPLIT_USDZ;
|
|
10557
10605
|
exports.ERR_UNSUPPORTED_UINT64 = ERR_UNSUPPORTED_UINT64;
|
|
10558
10606
|
exports.ERR_WORKER_STARTUP_TIMEOUT = ERR_WORKER_STARTUP_TIMEOUT;
|
|
10559
10607
|
exports.ERR_WRITER_NOT_INITIALIZED = ERR_WRITER_NOT_INITIALIZED;
|