@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
|
@@ -208,6 +208,8 @@ const STRICTNESS_TOLERANT = "tolerant";
|
|
|
208
208
|
const ERR_INVALID_FUNCTION_OPTION = "Invalid option (must be a function)";
|
|
209
209
|
const ERR_INVALID_SIGNAL = "Invalid signal (must be an AbortSignal instance)";
|
|
210
210
|
const ERR_INVALID_PASSWORD_TYPE = "Invalid password (password must be a string, rawPassword must be a Uint8Array)";
|
|
211
|
+
const ERR_ABORTED = "The operation was aborted";
|
|
212
|
+
const ABORT_ERROR_NAME = "AbortError";
|
|
211
213
|
|
|
212
214
|
function checkFunctionOption(value) {
|
|
213
215
|
if (value && typeof value != FUNCTION_TYPE) {
|
|
@@ -223,6 +225,12 @@ function checkSignalOption(signal) {
|
|
|
223
225
|
return signal || UNDEFINED_VALUE;
|
|
224
226
|
}
|
|
225
227
|
|
|
228
|
+
function throwIfAborted(signal) {
|
|
229
|
+
if (signal && signal.aborted) {
|
|
230
|
+
throw signal.reason === UNDEFINED_VALUE ? new DOMException(ERR_ABORTED, ABORT_ERROR_NAME) : signal.reason;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
function checkPasswordOption(password, rawPassword) {
|
|
227
235
|
if ((password && typeof password != STRING_TYPE) || (rawPassword && !(rawPassword instanceof Uint8Array))) {
|
|
228
236
|
throw new Error(ERR_INVALID_PASSWORD_TYPE);
|
|
@@ -3785,11 +3793,13 @@ class BlobReader extends Reader {
|
|
|
3785
3793
|
const reader = this;
|
|
3786
3794
|
const { sourceBlob, size } = reader;
|
|
3787
3795
|
const { offset = 0, size: readSize = size - offset } = options || {};
|
|
3788
|
-
if (
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3796
|
+
if (typeof sourceBlob.stream == FUNCTION_TYPE) {
|
|
3797
|
+
if (!offset && readSize >= size) {
|
|
3798
|
+
return toCompatibleReadable(sourceBlob.stream());
|
|
3799
|
+
}
|
|
3800
|
+
if (blobSliceReliable) {
|
|
3801
|
+
return toCompatibleReadable(sourceBlob.slice(offset, offset + readSize).stream());
|
|
3802
|
+
}
|
|
3793
3803
|
}
|
|
3794
3804
|
return super.createReadable(options);
|
|
3795
3805
|
}
|
|
@@ -5225,27 +5235,28 @@ class ZipReaderStream {
|
|
|
5225
5235
|
const { done, value } = await gen.next();
|
|
5226
5236
|
if (done)
|
|
5227
5237
|
return controller.close();
|
|
5228
|
-
const
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
return readable;
|
|
5235
|
-
}
|
|
5238
|
+
const entryReadable = (function () {
|
|
5239
|
+
const { readable, writable } = new TransformStream();
|
|
5240
|
+
if (value.getData) {
|
|
5241
|
+
getData();
|
|
5242
|
+
return readable;
|
|
5243
|
+
}
|
|
5236
5244
|
|
|
5237
|
-
|
|
5245
|
+
async function getData() {
|
|
5246
|
+
try {
|
|
5247
|
+
await value.getData(writable);
|
|
5248
|
+
} catch (error) {
|
|
5238
5249
|
try {
|
|
5239
|
-
await
|
|
5240
|
-
} catch
|
|
5241
|
-
|
|
5242
|
-
await writable.abort(error);
|
|
5243
|
-
} catch {
|
|
5244
|
-
// ignored
|
|
5245
|
-
}
|
|
5250
|
+
await writable.abort(error);
|
|
5251
|
+
} catch {
|
|
5252
|
+
// ignored
|
|
5246
5253
|
}
|
|
5247
5254
|
}
|
|
5248
|
-
}
|
|
5255
|
+
}
|
|
5256
|
+
})();
|
|
5257
|
+
const chunk = {
|
|
5258
|
+
...value,
|
|
5259
|
+
readable: entryReadable
|
|
5249
5260
|
};
|
|
5250
5261
|
delete chunk.getData;
|
|
5251
5262
|
controller.enqueue(chunk);
|
|
@@ -5391,6 +5402,7 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
5391
5402
|
const size = compressedSize;
|
|
5392
5403
|
const readable = toCompatibleReadable(reader.createReadable({ offset: dataOffset, size }));
|
|
5393
5404
|
const signal = checkSignalOption(getOptionValue$1(zipEntry, options, OPTION_SIGNAL));
|
|
5405
|
+
throwIfAborted(signal);
|
|
5394
5406
|
const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
|
|
5395
5407
|
let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
|
|
5396
5408
|
const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
|
|
@@ -6297,6 +6309,7 @@ const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
|
|
|
6297
6309
|
const ERR_INVALID_VERSION = "Version exceeds 65535";
|
|
6298
6310
|
const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
6299
6311
|
const ERR_UNSUPPORTED_ENCRYPTION_USDZ = "Encryption is not supported in USDZ files";
|
|
6312
|
+
const ERR_UNSUPPORTED_SPLIT_USDZ = "Split zip files are not supported in USDZ files";
|
|
6300
6313
|
const ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH = "Encryption is not supported when the 'passThrough' option is set";
|
|
6301
6314
|
const ERR_INVALID_EXTRAFIELD = "Invalid extra field (must be a Map)";
|
|
6302
6315
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Invalid extra field type (must be integer 0..65535)";
|
|
@@ -6311,6 +6324,7 @@ const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
|
6311
6324
|
const ERR_UNDEFINED_COMPRESSION_METHOD = "Undefined compression method";
|
|
6312
6325
|
const ERR_UNDETERMINED_SIZE = "Undetermined size";
|
|
6313
6326
|
const ERR_UNDEFINED_READER = "Undefined reader";
|
|
6327
|
+
const ERR_INVALID_READER = "Invalid reader (must be a Reader instance, a ReadableStream instance, or an object with a 'readable' property)";
|
|
6314
6328
|
const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
|
|
6315
6329
|
const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
|
|
6316
6330
|
const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
|
|
@@ -6342,6 +6356,9 @@ class ZipWriter {
|
|
|
6342
6356
|
const addSplitZipSignature =
|
|
6343
6357
|
availableSize > 0 && availableSize !== INFINITY_VALUE &&
|
|
6344
6358
|
maxSize > 0 && maxSize !== INFINITY_VALUE;
|
|
6359
|
+
if (addSplitZipSignature && options[OPTION_USDZ]) {
|
|
6360
|
+
throw new Error(ERR_UNSUPPORTED_SPLIT_USDZ);
|
|
6361
|
+
}
|
|
6345
6362
|
Object.assign(this, {
|
|
6346
6363
|
writer,
|
|
6347
6364
|
addSplitZipSignature,
|
|
@@ -6457,6 +6474,7 @@ class ZipWriter {
|
|
|
6457
6474
|
}
|
|
6458
6475
|
const { offset, diskNumberStart } = entryPositions.get(entry);
|
|
6459
6476
|
Object.assign(entry, {
|
|
6477
|
+
zip64Enabled: true,
|
|
6460
6478
|
zip64UncompressedSize,
|
|
6461
6479
|
zip64CompressedSize,
|
|
6462
6480
|
offset,
|
|
@@ -6915,6 +6933,7 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
6915
6933
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
6916
6934
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
6917
6935
|
const signal = checkSignalOption(getOptionValue(zipWriter, options, OPTION_SIGNAL));
|
|
6936
|
+
throwIfAborted(signal);
|
|
6918
6937
|
const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
|
|
6919
6938
|
const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
|
|
6920
6939
|
const registeredCodec = passThrough || compressionMethod === UNDEFINED_VALUE ? UNDEFINED_VALUE : getRegisteredCodec(compressionMethod);
|
|
@@ -7032,6 +7051,9 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
|
|
|
7032
7051
|
if (reader) {
|
|
7033
7052
|
reader = new GenericReader(reader);
|
|
7034
7053
|
await initStream(reader);
|
|
7054
|
+
if (!reader.readable && !reader.readUint8Array) {
|
|
7055
|
+
throw new Error(ERR_INVALID_READER);
|
|
7056
|
+
}
|
|
7035
7057
|
({ size: contentSize } = reader);
|
|
7036
7058
|
}
|
|
7037
7059
|
return Object.assign({ reader }, resolveEntrySizes(zipWriter, Boolean(reader), contentSize, metadata, options));
|
|
@@ -7042,6 +7064,7 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7042
7064
|
let { dataDescriptor, zip64, level, compressionMethod } = metadata;
|
|
7043
7065
|
let maximumCompressedSize = 0;
|
|
7044
7066
|
let uncompressedSize = 0;
|
|
7067
|
+
let unknownSize = false;
|
|
7045
7068
|
if (passThrough && hasContent) {
|
|
7046
7069
|
uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
|
|
7047
7070
|
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
@@ -7067,8 +7090,8 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7067
7090
|
if (contentSize === UNDEFINED_VALUE) {
|
|
7068
7091
|
dataDescriptor = true;
|
|
7069
7092
|
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
7070
|
-
zip64 = true;
|
|
7071
|
-
|
|
7093
|
+
zip64 = unknownSize = true;
|
|
7094
|
+
maximumCompressedSize = MAX_32_BITS + 1;
|
|
7072
7095
|
}
|
|
7073
7096
|
} else {
|
|
7074
7097
|
options.uncompressedSize = uncompressedSize = contentSize;
|
|
@@ -7083,7 +7106,7 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7083
7106
|
if (emptyEntry && !zipCrypto && getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR) === UNDEFINED_VALUE) {
|
|
7084
7107
|
dataDescriptor = false;
|
|
7085
7108
|
}
|
|
7086
|
-
const zip64UncompressedSize = zip64Enabled || uncompressedSize >= MAX_32_BITS;
|
|
7109
|
+
const zip64UncompressedSize = zip64Enabled || unknownSize || uncompressedSize >= MAX_32_BITS;
|
|
7087
7110
|
const zip64CompressedSize = zip64Enabled || maximumCompressedSize >= MAX_32_BITS;
|
|
7088
7111
|
if (zip64UncompressedSize || zip64CompressedSize) {
|
|
7089
7112
|
if (zip64 === false) {
|
|
@@ -7099,6 +7122,8 @@ function resolveEntrySizes(zipWriter, hasContent, contentSize, metadata, options
|
|
|
7099
7122
|
dataDescriptor,
|
|
7100
7123
|
emptyEntry,
|
|
7101
7124
|
zip64,
|
|
7125
|
+
zip64Enabled,
|
|
7126
|
+
unknownSize,
|
|
7102
7127
|
zip64UncompressedSize,
|
|
7103
7128
|
zip64CompressedSize,
|
|
7104
7129
|
uncompressedSize,
|
|
@@ -7172,7 +7197,7 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7172
7197
|
if (layoutDependsOnWriteOrder && !writeOrderGuaranteed) {
|
|
7173
7198
|
throw new Error(ERR_UNDETERMINED_SIZE);
|
|
7174
7199
|
}
|
|
7175
|
-
const directoryDataLength = createDirectoryRecords(files);
|
|
7200
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(files);
|
|
7176
7201
|
let zip64 = getOptionValue(zipWriter, writerOptions, PROPERTY_NAME_ZIP64);
|
|
7177
7202
|
if (offset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || files.size >= MAX_16_BITS) {
|
|
7178
7203
|
if (zip64 === false) {
|
|
@@ -7180,6 +7205,8 @@ async function getEntriesSize(writerOptions, entries, writeOrderGuaranteed, comm
|
|
|
7180
7205
|
} else {
|
|
7181
7206
|
zip64 = true;
|
|
7182
7207
|
}
|
|
7208
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
7209
|
+
zip64 = true;
|
|
7183
7210
|
}
|
|
7184
7211
|
return offset - initialOffset + directoryDataLength + commentLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
7185
7212
|
}
|
|
@@ -7372,6 +7399,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7372
7399
|
rawPassword,
|
|
7373
7400
|
level,
|
|
7374
7401
|
zip64,
|
|
7402
|
+
zip64Enabled,
|
|
7375
7403
|
zip64UncompressedSize,
|
|
7376
7404
|
zip64CompressedSize,
|
|
7377
7405
|
zipCrypto,
|
|
@@ -7412,6 +7440,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7412
7440
|
lockFileEntry,
|
|
7413
7441
|
versionMadeBy,
|
|
7414
7442
|
zip64,
|
|
7443
|
+
zip64Enabled,
|
|
7415
7444
|
directory: Boolean(directory),
|
|
7416
7445
|
executable: Boolean(executable),
|
|
7417
7446
|
filenameUTF8: true,
|
|
@@ -7555,13 +7584,14 @@ function getHeaderInfo(options) {
|
|
|
7555
7584
|
zip64UncompressedSize,
|
|
7556
7585
|
zip64CompressedSize,
|
|
7557
7586
|
uncompressedSize,
|
|
7587
|
+
unknownSize,
|
|
7558
7588
|
crc32
|
|
7559
7589
|
} = options;
|
|
7560
7590
|
let { version, compressionMethod } = options;
|
|
7561
7591
|
const compressed = !directory && isCompressed(compressionMethod, level);
|
|
7562
7592
|
let rawLocalExtraFieldZip64;
|
|
7563
7593
|
const uncompressedFile = passThrough || !compressed;
|
|
7564
|
-
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
7594
|
+
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || !dataDescriptor || ((!zip64UncompressedSize && !zip64CompressedSize) || (uncompressedFile && !unknownSize)));
|
|
7565
7595
|
const writeLocalExtraFieldZip64 = zip64ExtraFieldComplete || (zip64 && dataDescriptor && (zip64UncompressedSize || zip64CompressedSize));
|
|
7566
7596
|
if (zip64 && (zip64UncompressedSize || zip64CompressedSize)) {
|
|
7567
7597
|
const length = 4 + 16;
|
|
@@ -7695,6 +7725,10 @@ function getHeaderInfo(options) {
|
|
|
7695
7725
|
throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
|
|
7696
7726
|
}
|
|
7697
7727
|
const dosLastModDate = new Date(Math.ceil(Math.floor(lastModDate.getTime() / 1000) / 2) * 2000);
|
|
7728
|
+
const clampedLastModDate = dosLastModDate < MIN_DATE ? MIN_DATE : dosLastModDate > MAX_DATE ? MAX_DATE : dosLastModDate;
|
|
7729
|
+
const storedLastModDate = getLength(rawExtraFieldExtendedTimestamp) ?
|
|
7730
|
+
new Date(getTimeUnix(lastModDate) * 1000) :
|
|
7731
|
+
getLength(rawExtraFieldNTFS) ? lastModDate : clampedLastModDate;
|
|
7698
7732
|
const {
|
|
7699
7733
|
headerArray,
|
|
7700
7734
|
headerView,
|
|
@@ -7704,7 +7738,7 @@ function getHeaderInfo(options) {
|
|
|
7704
7738
|
bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
|
|
7705
7739
|
compressionMethod,
|
|
7706
7740
|
uncompressedSize,
|
|
7707
|
-
lastModDate:
|
|
7741
|
+
lastModDate: clampedLastModDate,
|
|
7708
7742
|
rawLastModDate: rawLastModDateOption,
|
|
7709
7743
|
rawFilename,
|
|
7710
7744
|
zip64CompressedSize,
|
|
@@ -7739,7 +7773,7 @@ function getHeaderInfo(options) {
|
|
|
7739
7773
|
localHeaderView,
|
|
7740
7774
|
headerArray,
|
|
7741
7775
|
headerView,
|
|
7742
|
-
lastModDate,
|
|
7776
|
+
lastModDate: storedLastModDate,
|
|
7743
7777
|
rawLastModDate,
|
|
7744
7778
|
encrypted,
|
|
7745
7779
|
compressed,
|
|
@@ -7911,14 +7945,15 @@ function updateLocalHeader({
|
|
|
7911
7945
|
|
|
7912
7946
|
|
|
7913
7947
|
async function closeFile(zipWriter, comment, options) {
|
|
7914
|
-
const directoryDataLength = createDirectoryRecords(zipWriter.fileEntries);
|
|
7948
|
+
const { directoryDataLength, zip64Entries } = createDirectoryRecords(zipWriter.fileEntries);
|
|
7915
7949
|
const { directoryStart, directoryEnd, directoryArray } = await writeDirectoryRecords(zipWriter, directoryDataLength, options);
|
|
7916
7950
|
const signatureLength = await writeDigitalSignatureRecord(zipWriter, directoryArray, options);
|
|
7917
|
-
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength });
|
|
7951
|
+
await writeEndOfDirectoryRecord(zipWriter, comment, options, { directoryStart, directoryEnd, directoryDataLength, signatureLength, zip64Entries });
|
|
7918
7952
|
}
|
|
7919
7953
|
|
|
7920
7954
|
function createDirectoryRecords(files) {
|
|
7921
7955
|
let directoryDataLength = 0;
|
|
7956
|
+
let zip64Entries = false;
|
|
7922
7957
|
for (const [, fileEntry] of files) {
|
|
7923
7958
|
const {
|
|
7924
7959
|
rawFilename,
|
|
@@ -7931,11 +7966,20 @@ function createDirectoryRecords(files) {
|
|
|
7931
7966
|
extendedTimestamp,
|
|
7932
7967
|
extraFieldExtendedTimestampFlag,
|
|
7933
7968
|
lastModDate,
|
|
7934
|
-
|
|
7935
|
-
zip64CompressedSize,
|
|
7969
|
+
zip64Enabled,
|
|
7936
7970
|
uncompressedSize,
|
|
7937
7971
|
compressedSize
|
|
7938
7972
|
} = fileEntry;
|
|
7973
|
+
let { zip64UncompressedSize, zip64CompressedSize } = fileEntry;
|
|
7974
|
+
if (!zip64Enabled) {
|
|
7975
|
+
if (zip64UncompressedSize && uncompressedSize < MAX_32_BITS) {
|
|
7976
|
+
zip64UncompressedSize = fileEntry.zip64UncompressedSize = false;
|
|
7977
|
+
}
|
|
7978
|
+
if (zip64CompressedSize && compressedSize < MAX_32_BITS) {
|
|
7979
|
+
zip64CompressedSize = fileEntry.zip64CompressedSize = false;
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
zip64Entries = zip64Entries || zip64UncompressedSize || zip64CompressedSize;
|
|
7939
7983
|
const zip64Offset = fileEntry.offset >= MAX_32_BITS;
|
|
7940
7984
|
const zip64DiskNumberStart = fileEntry.diskNumberStart >= MAX_16_BITS;
|
|
7941
7985
|
let rawExtraFieldZip64;
|
|
@@ -7989,7 +8033,7 @@ function createDirectoryRecords(files) {
|
|
|
7989
8033
|
}
|
|
7990
8034
|
directoryDataLength += CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
7991
8035
|
}
|
|
7992
|
-
return directoryDataLength;
|
|
8036
|
+
return { directoryDataLength, zip64Entries };
|
|
7993
8037
|
}
|
|
7994
8038
|
|
|
7995
8039
|
async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
@@ -8109,7 +8153,7 @@ async function writeDigitalSignatureRecord(zipWriter, directoryArray, options) {
|
|
|
8109
8153
|
|
|
8110
8154
|
async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
8111
8155
|
const { writer } = zipWriter;
|
|
8112
|
-
const { directoryStart, directoryEnd, signatureLength } = cdInfo;
|
|
8156
|
+
const { directoryStart, directoryEnd, signatureLength, zip64Entries } = cdInfo;
|
|
8113
8157
|
let { directoryDataLength } = cdInfo;
|
|
8114
8158
|
let fileEntriesLength = zipWriter.fileEntries.size;
|
|
8115
8159
|
let diskNumber = directoryStart.diskNumber;
|
|
@@ -8129,6 +8173,8 @@ async function writeEndOfDirectoryRecord(zipWriter, comment, options, cdInfo) {
|
|
|
8129
8173
|
} else {
|
|
8130
8174
|
zip64 = true;
|
|
8131
8175
|
}
|
|
8176
|
+
} else if (zip64 === UNDEFINED_VALUE && zip64Entries) {
|
|
8177
|
+
zip64 = true;
|
|
8132
8178
|
}
|
|
8133
8179
|
const endOfdirectoryRecord = createRecordWriter(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
|
|
8134
8180
|
if (exceedsAvailableSize(writer, getLength(endOfdirectoryRecord.array) + commentLength)) {
|
|
@@ -8632,7 +8678,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8632
8678
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8633
8679
|
*/
|
|
8634
8680
|
|
|
8635
|
-
const VERSION = "2.11.
|
|
8681
|
+
const VERSION = "2.11.4";
|
|
8636
8682
|
|
|
8637
8683
|
/*
|
|
8638
8684
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|
|
@@ -9505,8 +9551,6 @@ const ERR_INVALID_PASS_THROUGH = "Invalid passThrough option (use readerOptions.
|
|
|
9505
9551
|
const ERR_INVALID_READER_OPTIONS = "Invalid readerOptions (must be an object)";
|
|
9506
9552
|
const ERR_ZIP_CRYPTO_LAST_MOD_DATE = "The last modification date of an entry encrypted with ZipCrypto cannot be changed when passThrough is set";
|
|
9507
9553
|
const ERR_ABORT_EXPORT = "zipjs-abort-export";
|
|
9508
|
-
const ERR_ABORTED = "The operation was aborted";
|
|
9509
|
-
const ABORT_ERROR_NAME = "AbortError";
|
|
9510
9554
|
const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
|
|
9511
9555
|
const INTERPRETED_EXTRA_FIELD_TYPES = new Set([
|
|
9512
9556
|
EXTRAFIELD_TYPE_ZIP64,
|
|
@@ -10000,12 +10044,14 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10000
10044
|
if (options.bufferedWrite === UNDEFINED_VALUE) {
|
|
10001
10045
|
options.bufferedWrite = true;
|
|
10002
10046
|
}
|
|
10003
|
-
const
|
|
10047
|
+
const children = zipEntry.getChildren({ recursive: true });
|
|
10048
|
+
const entries = children.filter(child => !isImplicitDirectory(child)).map(child => {
|
|
10004
10049
|
const { name, entryOptions } = getChildEntryOptions(child, zipEntry, options);
|
|
10005
10050
|
return { name, size: child.directory ? 0 : getDeterminedSize(child, isPassThrough(child, options)), options: entryOptions };
|
|
10006
10051
|
});
|
|
10007
10052
|
const writeOrderGuaranteed = !options.bufferedWrite ||
|
|
10008
|
-
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10053
|
+
(entries.every(entry => entry.options.keepOrder !== false) &&
|
|
10054
|
+
children.every(child => isImplicitDirectory(child) || !child.children.length));
|
|
10009
10055
|
return getEntriesSize(options, entries, writeOrderGuaranteed, options.globalComment);
|
|
10010
10056
|
}
|
|
10011
10057
|
|
|
@@ -10892,4 +10938,4 @@ function getPathParent(parent, path, movedEntry) {
|
|
|
10892
10938
|
return parent;
|
|
10893
10939
|
}
|
|
10894
10940
|
|
|
10895
|
-
export { BlobReader, BlobWriter, Data64URIReader, Data64URIWriter, ERR_ABORTED, ERR_AMBIGUOUS_ARCHIVE, ERR_BAD_FORMAT, ERR_CENTRAL_DIRECTORY_NOT_FOUND, ERR_DUPLICATED_NAME, ERR_DUPLICATE_IMPORTED_ENTRY, ERR_ENCRYPTED, ERR_ENCRYPTED_CENTRAL_DIRECTORY, ERR_ENTRY_DATA_OUT_OF_BOUNDS, ERR_ENTRY_EXISTS, ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND, ERR_EOCDR_NOT_FOUND, ERR_EXTRAFIELD_ZIP64_NOT_FOUND, ERR_HTTP_RANGE, ERR_HTTP_RESOURCE_CHANGED, ERR_INVALID_AUTHENTICATION_CODE, ERR_INVALID_CODEC_DEFINITION, ERR_INVALID_CODEC_MODULE, ERR_INVALID_COMMENT, ERR_INVALID_COMMENT_TYPE, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, ERR_INVALID_DATE, ERR_INVALID_DUPLICATES, ERR_INVALID_ENCRYPTION_STRENGTH, ERR_INVALID_ENTRY_COMMENT, ERR_INVALID_ENTRY_COMMENT_TYPE, ERR_INVALID_ENTRY_NAME, ERR_INVALID_EXTRAFIELD, ERR_INVALID_EXTRAFIELD_DATA, ERR_INVALID_EXTRAFIELD_DATA_TYPE, ERR_INVALID_EXTRAFIELD_TYPE, ERR_INVALID_FILENAME_VALIDATION, ERR_INVALID_FUNCTION_OPTION, ERR_INVALID_GID, ERR_INVALID_LEVEL, ERR_INVALID_MAX_APPENDED_DATA_SIZE, ERR_INVALID_MAX_WORKERS, ERR_INVALID_MSDOS_ATTRIBUTES, ERR_INVALID_MSDOS_DATA, ERR_INVALID_PASSWORD, ERR_INVALID_PASSWORD_TYPE, ERR_INVALID_PASS_THROUGH, ERR_INVALID_READER_OPTIONS, ERR_INVALID_SIGNAL, ERR_INVALID_SIGNATURE_DATA, ERR_INVALID_STRICTNESS, ERR_INVALID_UID, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_UNIX_EXTRA_FIELD_TYPE, ERR_INVALID_UNIX_ID_SIZE, ERR_INVALID_UNIX_MODE, ERR_INVALID_VERSION, ERR_ITERATOR_COMPLETED_TOO_SOON, ERR_LOCAL_FILE_HEADER_NOT_FOUND, ERR_OVERLAPPING_ENTRY, ERR_READABLE_CONSUMED, ERR_RESERVED_COMPRESSION_METHOD, ERR_SPLIT_ZIP_FILE, ERR_UNDEFINED_COMPRESSION_METHOD, ERR_UNDEFINED_READER, ERR_UNDEFINED_UNCOMPRESSED_SIZE, ERR_UNDETERMINED_SIZE, ERR_UNSAFE_FILENAME, ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_CONTEXT, ERR_UNSUPPORTED_CRYPTO_API, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_UNSUPPORTED_UINT64, ERR_WORKER_STARTUP_TIMEOUT, ERR_WRITER_NOT_INITIALIZED, ERR_ZIP_CRYPTO_LAST_MOD_DATE, ERR_ZIP_NOT_EMPTY, HttpRangeReader, HttpReader, Reader, SplitDataReader, SplitDataWriter, TextReader, TextWriter, Uint8ArrayReader, Uint8ArrayWriter, VERSION, WARNING_APPENDED_DATA, WARNING_COMPRESSED_PATCHED_DATA, WARNING_DUPLICATE_FILENAME, WARNING_MALFORMED_EXTRA_FIELD, WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG, WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD, WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES, WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY, WARNING_PREPENDED_CENTRAL_DIRECTORY, WARNING_PREPENDED_DATA, WARNING_TRAILING_CENTRAL_DIRECTORY_DATA, WARNING_UNKNOWN_VERSION, WARNING_UNKNOWN_ZIP64_EXTENSIBLE_DATA, WARNING_UNSORTED_CENTRAL_DIRECTORY, WARNING_WRAPPED_ENTRIES_COUNT, Writer, ZipDirectoryEntry, ZipEntry, ZipFS, ZipFileEntry, ZipReader, ZipReaderStream, ZipWriter, ZipWriterStream, configure, createBlobTempStream, createOPFSTempStream, createSyncAccessHandleTempStream, fs, getMimeType, getRegisteredCodecs, getSupportedCompressionMethods, isZipFile, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };
|
|
10941
|
+
export { BlobReader, BlobWriter, Data64URIReader, Data64URIWriter, ERR_ABORTED, ERR_AMBIGUOUS_ARCHIVE, ERR_BAD_FORMAT, ERR_CENTRAL_DIRECTORY_NOT_FOUND, ERR_DUPLICATED_NAME, ERR_DUPLICATE_IMPORTED_ENTRY, ERR_ENCRYPTED, ERR_ENCRYPTED_CENTRAL_DIRECTORY, ERR_ENTRY_DATA_OUT_OF_BOUNDS, ERR_ENTRY_EXISTS, ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND, ERR_EOCDR_NOT_FOUND, ERR_EXTRAFIELD_ZIP64_NOT_FOUND, ERR_HTTP_RANGE, ERR_HTTP_RESOURCE_CHANGED, ERR_INVALID_AUTHENTICATION_CODE, ERR_INVALID_CODEC_DEFINITION, ERR_INVALID_CODEC_MODULE, ERR_INVALID_COMMENT, ERR_INVALID_COMMENT_TYPE, ERR_INVALID_COMPRESSED_DATA, ERR_INVALID_CRC32, ERR_INVALID_DATE, ERR_INVALID_DUPLICATES, ERR_INVALID_ENCRYPTION_STRENGTH, ERR_INVALID_ENTRY_COMMENT, ERR_INVALID_ENTRY_COMMENT_TYPE, ERR_INVALID_ENTRY_NAME, ERR_INVALID_EXTRAFIELD, ERR_INVALID_EXTRAFIELD_DATA, ERR_INVALID_EXTRAFIELD_DATA_TYPE, ERR_INVALID_EXTRAFIELD_TYPE, ERR_INVALID_FILENAME_VALIDATION, ERR_INVALID_FUNCTION_OPTION, ERR_INVALID_GID, ERR_INVALID_LEVEL, ERR_INVALID_MAX_APPENDED_DATA_SIZE, ERR_INVALID_MAX_WORKERS, ERR_INVALID_MSDOS_ATTRIBUTES, ERR_INVALID_MSDOS_DATA, ERR_INVALID_PASSWORD, ERR_INVALID_PASSWORD_TYPE, ERR_INVALID_PASS_THROUGH, ERR_INVALID_READER, ERR_INVALID_READER_OPTIONS, ERR_INVALID_SIGNAL, ERR_INVALID_SIGNATURE_DATA, ERR_INVALID_STRICTNESS, ERR_INVALID_UID, ERR_INVALID_UNCOMPRESSED_SIZE, ERR_INVALID_UNIX_EXTRA_FIELD_TYPE, ERR_INVALID_UNIX_ID_SIZE, ERR_INVALID_UNIX_MODE, ERR_INVALID_VERSION, ERR_ITERATOR_COMPLETED_TOO_SOON, ERR_LOCAL_FILE_HEADER_NOT_FOUND, ERR_OVERLAPPING_ENTRY, ERR_READABLE_CONSUMED, ERR_RESERVED_COMPRESSION_METHOD, ERR_SPLIT_ZIP_FILE, ERR_UNDEFINED_COMPRESSION_METHOD, ERR_UNDEFINED_READER, ERR_UNDEFINED_UNCOMPRESSED_SIZE, ERR_UNDETERMINED_SIZE, ERR_UNSAFE_FILENAME, ERR_UNSUPPORTED_COMPRESSION, ERR_UNSUPPORTED_CONTEXT, ERR_UNSUPPORTED_CRYPTO_API, ERR_UNSUPPORTED_ENCRYPTION, ERR_UNSUPPORTED_ENCRYPTION_PASS_THROUGH, ERR_UNSUPPORTED_ENCRYPTION_USDZ, ERR_UNSUPPORTED_FORMAT, ERR_UNSUPPORTED_SPLIT_USDZ, ERR_UNSUPPORTED_UINT64, ERR_WORKER_STARTUP_TIMEOUT, ERR_WRITER_NOT_INITIALIZED, ERR_ZIP_CRYPTO_LAST_MOD_DATE, ERR_ZIP_NOT_EMPTY, HttpRangeReader, HttpReader, Reader, SplitDataReader, SplitDataWriter, TextReader, TextWriter, Uint8ArrayReader, Uint8ArrayWriter, VERSION, WARNING_APPENDED_DATA, WARNING_COMPRESSED_PATCHED_DATA, WARNING_DUPLICATE_FILENAME, WARNING_MALFORMED_EXTRA_FIELD, WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG, WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD, WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES, WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY, WARNING_PREPENDED_CENTRAL_DIRECTORY, WARNING_PREPENDED_DATA, WARNING_TRAILING_CENTRAL_DIRECTORY_DATA, WARNING_UNKNOWN_VERSION, WARNING_UNKNOWN_ZIP64_EXTENSIBLE_DATA, WARNING_UNSORTED_CENTRAL_DIRECTORY, WARNING_WRAPPED_ENTRIES_COUNT, Writer, ZipDirectoryEntry, ZipEntry, ZipFS, ZipFileEntry, ZipReader, ZipReaderStream, ZipWriter, ZipWriterStream, configure, createBlobTempStream, createOPFSTempStream, createSyncAccessHandleTempStream, fs, getMimeType, getRegisteredCodecs, getSupportedCompressionMethods, isZipFile, registerCodec, resetConfiguration, terminateWorkersAndModule as terminateWorkers, unregisterCodec };
|