@zip.js/zip.js 2.18.1 → 2.19.0
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 +122 -118
- package/deno.json +1 -1
- package/dist/zip-core-external.js +59 -94
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +59 -94
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +59 -94
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +59 -94
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +59 -94
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +61 -96
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +60 -95
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +61 -96
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +61 -96
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +60 -95
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +61 -96
- package/index-native.min.js +1 -1
- package/index.cjs +60 -95
- package/index.d.cts +33 -23
- package/index.d.ts +33 -23
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +1 -2
- package/lib/core/codec-worker-web.js +11 -39
- package/lib/core/codec-worker.js +1 -2
- package/lib/core/configuration.js +1 -1
- package/lib/core/options.js +0 -2
- package/lib/core/streams/codec-stream.js +1 -1
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +2 -3
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +26 -36
- package/lib/core/zip-writer.js +18 -14
- package/package.json +1 -1
- package/worker-message-property-names.js +1 -1
|
@@ -176,7 +176,6 @@ const OPTION_CHECK_CRC32 = "checkCrc32";
|
|
|
176
176
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
177
177
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
178
178
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
179
|
-
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
180
179
|
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
181
180
|
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
182
181
|
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
@@ -294,7 +293,7 @@ function toNumber(value) {
|
|
|
294
293
|
*/
|
|
295
294
|
|
|
296
295
|
|
|
297
|
-
const DEFAULT_CHUNK_SIZE$1 =
|
|
296
|
+
const DEFAULT_CHUNK_SIZE$1 = 256 * 1024;
|
|
298
297
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
299
298
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
300
299
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
@@ -2423,7 +2422,7 @@ function mapInflateStreamError(readable, sourceErrors) {
|
|
|
2423
2422
|
*/
|
|
2424
2423
|
|
|
2425
2424
|
|
|
2426
|
-
const DEFAULT_CHUNK_SIZE =
|
|
2425
|
+
const DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
2427
2426
|
const MESSAGE_EVENT_TYPE = "message";
|
|
2428
2427
|
const MESSAGE_START = "start";
|
|
2429
2428
|
const MESSAGE_PULL = "pull";
|
|
@@ -2633,7 +2632,7 @@ function disableWebWorker(workerData) {
|
|
|
2633
2632
|
class CodecWorker {
|
|
2634
2633
|
|
|
2635
2634
|
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2636
|
-
const { options, config, streamOptions, useWebWorkers,
|
|
2635
|
+
const { options, config, streamOptions, useWebWorkers, workerURI } = workerOptions;
|
|
2637
2636
|
let { createWorker } = workerOptions;
|
|
2638
2637
|
const { signal } = streamOptions;
|
|
2639
2638
|
if (createWorkerFailed) {
|
|
@@ -2650,7 +2649,6 @@ class CodecWorker {
|
|
|
2650
2649
|
workerOptions,
|
|
2651
2650
|
workerURI,
|
|
2652
2651
|
createWorker,
|
|
2653
|
-
transferStreams,
|
|
2654
2652
|
terminate() {
|
|
2655
2653
|
return new Promise(resolve => {
|
|
2656
2654
|
const { worker, busy } = workerData;
|
|
@@ -2828,12 +2826,6 @@ const MESSAGE_ERROR_EVENT_TYPE = "messageerror";
|
|
|
2828
2826
|
const ABORT_EVENT_TYPE = "abort";
|
|
2829
2827
|
|
|
2830
2828
|
let webWorkerSource, webWorkerURI, webWorkerOptions;
|
|
2831
|
-
let transferStreamsSupported = true;
|
|
2832
|
-
try {
|
|
2833
|
-
transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
|
|
2834
|
-
} catch {
|
|
2835
|
-
// ignored
|
|
2836
|
-
}
|
|
2837
2829
|
|
|
2838
2830
|
setWebWorkerBackend(createWebWorkerInterface);
|
|
2839
2831
|
|
|
@@ -2920,14 +2912,11 @@ async function runWebWorker(workerData, config) {
|
|
|
2920
2912
|
});
|
|
2921
2913
|
const { readable, options } = workerData;
|
|
2922
2914
|
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable, workerData);
|
|
2923
|
-
let streamsTransferred;
|
|
2924
2915
|
try {
|
|
2925
|
-
|
|
2916
|
+
sendMessage({
|
|
2926
2917
|
type: MESSAGE_START,
|
|
2927
2918
|
options,
|
|
2928
|
-
config
|
|
2929
|
-
readable,
|
|
2930
|
-
writable
|
|
2919
|
+
config
|
|
2931
2920
|
}, workerData);
|
|
2932
2921
|
} catch (error) {
|
|
2933
2922
|
abortPipe();
|
|
@@ -2939,12 +2928,10 @@ async function runWebWorker(workerData, config) {
|
|
|
2939
2928
|
workerData.onTaskFinished();
|
|
2940
2929
|
throw error;
|
|
2941
2930
|
}
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
});
|
|
2947
|
-
}
|
|
2931
|
+
Object.assign(workerData, {
|
|
2932
|
+
reader: readable.getReader(),
|
|
2933
|
+
writer: writable.getWriter()
|
|
2934
|
+
});
|
|
2948
2935
|
const { workerStartupTimeout } = config;
|
|
2949
2936
|
if (!workerData.workerAlive && Number.isFinite(workerStartupTimeout) && workerStartupTimeout >= 0) {
|
|
2950
2937
|
workerData.startupTimeout = setTimeout(() => onStartupTimeout(workerData), workerStartupTimeout);
|
|
@@ -2977,7 +2964,7 @@ async function runWebWorker(workerData, config) {
|
|
|
2977
2964
|
}
|
|
2978
2965
|
|
|
2979
2966
|
async function closeWritable() {
|
|
2980
|
-
if (!
|
|
2967
|
+
if (!writable.locked) {
|
|
2981
2968
|
try {
|
|
2982
2969
|
await writable.getWriter().close();
|
|
2983
2970
|
} catch {
|
|
@@ -3168,31 +3155,14 @@ function onWorkerError(event, workerData) {
|
|
|
3168
3155
|
}
|
|
3169
3156
|
}
|
|
3170
3157
|
|
|
3171
|
-
function sendMessage(message, { worker, writer
|
|
3158
|
+
function sendMessage(message, { worker, writer }) {
|
|
3172
3159
|
try {
|
|
3173
|
-
const { value
|
|
3174
|
-
const transferables = [];
|
|
3160
|
+
const { value } = message;
|
|
3175
3161
|
if (value) {
|
|
3176
3162
|
message.value = toExactUint8Array(value);
|
|
3177
|
-
transferables.push(message.value.buffer);
|
|
3178
|
-
}
|
|
3179
|
-
if (transferStreams && transferStreamsSupported && workerAlive) {
|
|
3180
|
-
if (readable) {
|
|
3181
|
-
transferables.push(readable);
|
|
3182
|
-
}
|
|
3183
|
-
if (writable) {
|
|
3184
|
-
transferables.push(writable);
|
|
3185
|
-
}
|
|
3186
|
-
} else {
|
|
3187
|
-
message.readable = message.writable = null;
|
|
3188
|
-
}
|
|
3189
|
-
if (transferables.length) {
|
|
3190
3163
|
try {
|
|
3191
|
-
worker.postMessage(message,
|
|
3192
|
-
return true;
|
|
3164
|
+
worker.postMessage(message, [message.value.buffer]);
|
|
3193
3165
|
} catch {
|
|
3194
|
-
transferStreamsSupported = false;
|
|
3195
|
-
message.readable = message.writable = null;
|
|
3196
3166
|
worker.postMessage(message);
|
|
3197
3167
|
}
|
|
3198
3168
|
} else {
|
|
@@ -3341,7 +3311,7 @@ let indexWorker = 0;
|
|
|
3341
3311
|
|
|
3342
3312
|
async function runWorker(stream, workerOptions) {
|
|
3343
3313
|
const { options, config } = workerOptions;
|
|
3344
|
-
const {
|
|
3314
|
+
const { useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3345
3315
|
const { workerURI, createWorker, maxWorkers } = config;
|
|
3346
3316
|
if (format) {
|
|
3347
3317
|
if (codecURI) {
|
|
@@ -3349,7 +3319,6 @@ async function runWorker(stream, workerOptions) {
|
|
|
3349
3319
|
}
|
|
3350
3320
|
await ensureCodecStreams(format, options.codecURI);
|
|
3351
3321
|
}
|
|
3352
|
-
workerOptions.transferStreams = !format && (transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams));
|
|
3353
3322
|
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3354
3323
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3355
3324
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
@@ -5131,17 +5100,6 @@ class ZipReader {
|
|
|
5131
5100
|
if (filename === UNDEFINED_VALUE) {
|
|
5132
5101
|
filename = decodeText(rawFilename, rawFilenameEncoding);
|
|
5133
5102
|
}
|
|
5134
|
-
if (normalizeFilename) {
|
|
5135
|
-
const normalizedFilename = normalizeFilename(filename);
|
|
5136
|
-
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5137
|
-
filename = normalizedFilename;
|
|
5138
|
-
}
|
|
5139
|
-
}
|
|
5140
|
-
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5141
|
-
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5142
|
-
error.filename = filename;
|
|
5143
|
-
throw error;
|
|
5144
|
-
}
|
|
5145
5103
|
let comment = decode(rawComment, rawCommentEncoding, TEXT_TYPE_COMMENT);
|
|
5146
5104
|
if (comment === UNDEFINED_VALUE) {
|
|
5147
5105
|
comment = decodeText(rawComment, rawCommentEncoding);
|
|
@@ -5169,7 +5127,20 @@ class ZipReader {
|
|
|
5169
5127
|
filename,
|
|
5170
5128
|
comment
|
|
5171
5129
|
});
|
|
5172
|
-
|
|
5130
|
+
const malformedExtraField = readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
5131
|
+
filename = fileEntry.filename;
|
|
5132
|
+
if (normalizeFilename) {
|
|
5133
|
+
const normalizedFilename = normalizeFilename(filename);
|
|
5134
|
+
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5135
|
+
filename = fileEntry.filename = normalizedFilename;
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5139
|
+
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5140
|
+
error.filename = filename;
|
|
5141
|
+
throw error;
|
|
5142
|
+
}
|
|
5143
|
+
if (malformedExtraField) {
|
|
5173
5144
|
addWarning(warnings, WARNING_MALFORMED_EXTRA_FIELD, filename);
|
|
5174
5145
|
}
|
|
5175
5146
|
fileEntry.offset += prependedDataLength;
|
|
@@ -5573,7 +5544,6 @@ class ZipEntry {
|
|
|
5573
5544
|
encrypted,
|
|
5574
5545
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
5575
5546
|
useCompressionStream,
|
|
5576
|
-
transferStreams: getOptionValue$1(zipEntry, options, OPTION_TRANSFER_STREAMS),
|
|
5577
5547
|
deflate64,
|
|
5578
5548
|
format: registeredCodec ? registeredCodec.format : UNDEFINED_VALUE,
|
|
5579
5549
|
codecURI: registeredCodec ? registeredCodec.codecURI : UNDEFINED_VALUE,
|
|
@@ -5803,19 +5773,17 @@ function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory
|
|
|
5803
5773
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
5804
5774
|
directory.extraFieldNTFS = extraFieldNTFS;
|
|
5805
5775
|
}
|
|
5806
|
-
const
|
|
5776
|
+
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5807
5777
|
let unixIdsRead;
|
|
5778
|
+
if (extraFieldInfoZip) {
|
|
5779
|
+
unixIdsRead = readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5780
|
+
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5781
|
+
}
|
|
5782
|
+
const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
|
|
5808
5783
|
if (extraFieldUnix) {
|
|
5809
|
-
|
|
5784
|
+
readExtraFieldUnix(extraFieldUnix, unixIdsRead ? {} : directory, false);
|
|
5810
5785
|
directory.extraFieldUnix = extraFieldUnix;
|
|
5811
5786
|
}
|
|
5812
|
-
if (!unixIdsRead) {
|
|
5813
|
-
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5814
|
-
if (extraFieldInfoZip) {
|
|
5815
|
-
readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5816
|
-
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5817
|
-
}
|
|
5818
|
-
}
|
|
5819
5787
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
5820
5788
|
if (extraFieldExtendedTimestamp) {
|
|
5821
5789
|
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
@@ -6041,19 +6009,11 @@ async function detectOverlappingEntry({
|
|
|
6041
6009
|
const zip64 = Boolean(extraFieldZip64);
|
|
6042
6010
|
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6043
6011
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6044
|
-
const
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6050
|
-
localDataDescriptor = candidate;
|
|
6051
|
-
break;
|
|
6052
|
-
}
|
|
6053
|
-
}
|
|
6054
|
-
if (!localDataDescriptor) {
|
|
6055
|
-
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6056
|
-
}
|
|
6012
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
6013
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
6014
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
6015
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
6016
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6057
6017
|
if (localDataDescriptor) {
|
|
6058
6018
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6059
6019
|
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
@@ -6710,6 +6670,7 @@ class ZipWriter {
|
|
|
6710
6670
|
rawExtraFieldExtendedTimestamp: EMPTY_UINT8_ARRAY,
|
|
6711
6671
|
rawExtraFieldNTFS: EMPTY_UINT8_ARRAY,
|
|
6712
6672
|
rawExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6673
|
+
rawCentralExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6713
6674
|
rawExtraField,
|
|
6714
6675
|
rawCentralExtraField: EMPTY_UINT8_ARRAY,
|
|
6715
6676
|
headerArray,
|
|
@@ -7278,7 +7239,6 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
7278
7239
|
const ntfsTimestamp = getOptionValue(zipWriter, options, OPTION_NTFS_TIMESTAMP);
|
|
7279
7240
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
7280
7241
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
7281
|
-
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS);
|
|
7282
7242
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
7283
7243
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
7284
7244
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
@@ -7344,7 +7304,6 @@ function resolveMetadata(zipWriter, name, options) {
|
|
|
7344
7304
|
ntfsTimestamp,
|
|
7345
7305
|
keepOrder,
|
|
7346
7306
|
useWebWorkers,
|
|
7347
|
-
transferStreams,
|
|
7348
7307
|
bufferedWrite,
|
|
7349
7308
|
createTempStream,
|
|
7350
7309
|
dataDescriptorSignature,
|
|
@@ -7403,7 +7362,7 @@ async function resolveSizes(zipWriter, reader, { resolvedOptions: metadata }, op
|
|
|
7403
7362
|
if (reader) {
|
|
7404
7363
|
reader = new GenericReader(reader);
|
|
7405
7364
|
await initStream(reader);
|
|
7406
|
-
if (!reader.
|
|
7365
|
+
if (!reader.readUint8Array && !reader.readable) {
|
|
7407
7366
|
throw new Error(ERR_INVALID_READER);
|
|
7408
7367
|
}
|
|
7409
7368
|
({ size: contentSize } = reader);
|
|
@@ -7666,6 +7625,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7666
7625
|
extraFieldExtendedTimestampTime,
|
|
7667
7626
|
rawExtraFieldNTFS,
|
|
7668
7627
|
rawExtraFieldUnix,
|
|
7628
|
+
rawCentralExtraFieldUnix,
|
|
7669
7629
|
rawExtraFieldAES,
|
|
7670
7630
|
} = headerInfo;
|
|
7671
7631
|
const { dataDescriptorArray } = dataDescriptorInfo;
|
|
@@ -7690,7 +7650,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7690
7650
|
rawExtraField,
|
|
7691
7651
|
rawCentralExtraField,
|
|
7692
7652
|
useWebWorkers,
|
|
7693
|
-
transferStreams,
|
|
7694
7653
|
onstart,
|
|
7695
7654
|
onprogress,
|
|
7696
7655
|
onend,
|
|
@@ -7732,6 +7691,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7732
7691
|
rawExtraFieldExtendedTimestamp,
|
|
7733
7692
|
rawExtraFieldNTFS,
|
|
7734
7693
|
rawExtraFieldUnix,
|
|
7694
|
+
rawCentralExtraFieldUnix,
|
|
7735
7695
|
rawExtraFieldAES,
|
|
7736
7696
|
rawExtraField,
|
|
7737
7697
|
rawCentralExtraField,
|
|
@@ -7778,7 +7738,6 @@ async function createFileEntry(reader, writer, { diskNumberStart, lockFileEntry
|
|
|
7778
7738
|
encrypted: encrypted && !passThroughEncryption,
|
|
7779
7739
|
useWebWorkers,
|
|
7780
7740
|
useCompressionStream,
|
|
7781
|
-
transferStreams,
|
|
7782
7741
|
format,
|
|
7783
7742
|
codecURI,
|
|
7784
7743
|
compressionMethod
|
|
@@ -7956,6 +7915,7 @@ function getHeaderInfo(options) {
|
|
|
7956
7915
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = EMPTY_UINT8_ARRAY;
|
|
7957
7916
|
}
|
|
7958
7917
|
let rawExtraFieldUnix;
|
|
7918
|
+
let rawCentralExtraFieldUnix;
|
|
7959
7919
|
try {
|
|
7960
7920
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7961
7921
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
@@ -7970,7 +7930,7 @@ function getHeaderInfo(options) {
|
|
|
7970
7930
|
extraFieldUnix.writeBytes(uidBytes);
|
|
7971
7931
|
extraFieldUnix.writeUint8(gidBytes.length);
|
|
7972
7932
|
extraFieldUnix.writeBytes(gidBytes);
|
|
7973
|
-
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7933
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = extraFieldUnix.array;
|
|
7974
7934
|
} else if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7975
7935
|
const extraFieldUnix = createRecordWriter(8);
|
|
7976
7936
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
@@ -7978,11 +7938,15 @@ function getHeaderInfo(options) {
|
|
|
7978
7938
|
extraFieldUnix.writeUint16((uid === UNDEFINED_VALUE ? 0 : uid) & MAX_16_BITS);
|
|
7979
7939
|
extraFieldUnix.writeUint16((gid === UNDEFINED_VALUE ? 0 : gid) & MAX_16_BITS);
|
|
7980
7940
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7941
|
+
const centralExtraFieldUnix = createRecordWriter(4);
|
|
7942
|
+
centralExtraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
7943
|
+
centralExtraFieldUnix.writeUint16(0);
|
|
7944
|
+
rawCentralExtraFieldUnix = centralExtraFieldUnix.array;
|
|
7981
7945
|
} else {
|
|
7982
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7946
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7983
7947
|
}
|
|
7984
7948
|
} catch {
|
|
7985
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7949
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7986
7950
|
}
|
|
7987
7951
|
if (compressionMethod === UNDEFINED_VALUE) {
|
|
7988
7952
|
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
@@ -8074,6 +8038,7 @@ function getHeaderInfo(options) {
|
|
|
8074
8038
|
rawExtraFieldExtendedTimestamp,
|
|
8075
8039
|
rawExtraFieldNTFS,
|
|
8076
8040
|
rawExtraFieldUnix,
|
|
8041
|
+
rawCentralExtraFieldUnix,
|
|
8077
8042
|
rawExtraFieldAES,
|
|
8078
8043
|
extraFieldLength
|
|
8079
8044
|
};
|
|
@@ -8249,7 +8214,7 @@ function createDirectoryRecords(files) {
|
|
|
8249
8214
|
rawExtraFieldAES,
|
|
8250
8215
|
rawComment,
|
|
8251
8216
|
rawExtraFieldNTFS,
|
|
8252
|
-
|
|
8217
|
+
rawCentralExtraFieldUnix,
|
|
8253
8218
|
rawExtraField,
|
|
8254
8219
|
rawCentralExtraField,
|
|
8255
8220
|
extraFieldExtendedTimestampFlag,
|
|
@@ -8311,7 +8276,7 @@ function createDirectoryRecords(files) {
|
|
|
8311
8276
|
rawExtraFieldZip64,
|
|
8312
8277
|
rawExtraFieldAES,
|
|
8313
8278
|
rawExtraFieldNTFS,
|
|
8314
|
-
|
|
8279
|
+
rawCentralExtraFieldUnix,
|
|
8315
8280
|
rawExtraFieldTimestamp,
|
|
8316
8281
|
rawExtraField,
|
|
8317
8282
|
rawCentralExtraField);
|
|
@@ -8340,7 +8305,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8340
8305
|
rawExtraFieldAES,
|
|
8341
8306
|
rawExtraFieldExtendedTimestamp,
|
|
8342
8307
|
rawExtraFieldNTFS,
|
|
8343
|
-
|
|
8308
|
+
rawCentralExtraFieldUnix,
|
|
8344
8309
|
rawExtraField,
|
|
8345
8310
|
rawCentralExtraField,
|
|
8346
8311
|
rawComment,
|
|
@@ -8357,7 +8322,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8357
8322
|
uncompressedSize,
|
|
8358
8323
|
compressedSize
|
|
8359
8324
|
} = fileEntry;
|
|
8360
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS,
|
|
8325
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawCentralExtraFieldUnix, rawExtraField, rawCentralExtraField);
|
|
8361
8326
|
const directoryRecordLength = CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
8362
8327
|
if (exceedsAvailableSize(writer, offset + directoryRecordLength - directoryDiskOffset)) {
|
|
8363
8328
|
await writeData(writer, directoryArray.slice(directoryDiskOffset, offset));
|
|
@@ -8393,7 +8358,7 @@ async function writeDirectoryRecords(zipWriter, directoryDataLength, options) {
|
|
|
8393
8358
|
directoryRecord.writeBytes(rawExtraFieldAES);
|
|
8394
8359
|
directoryRecord.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
8395
8360
|
directoryRecord.writeBytes(rawExtraFieldNTFS);
|
|
8396
|
-
directoryRecord.writeBytes(
|
|
8361
|
+
directoryRecord.writeBytes(rawCentralExtraFieldUnix);
|
|
8397
8362
|
directoryRecord.writeBytes(rawExtraField);
|
|
8398
8363
|
directoryRecord.writeBytes(rawCentralExtraField);
|
|
8399
8364
|
directoryRecord.writeBytes(rawComment);
|
|
@@ -8970,7 +8935,7 @@ function formatSupported(StreamClass, format) {
|
|
|
8970
8935
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8971
8936
|
*/
|
|
8972
8937
|
|
|
8973
|
-
const VERSION = "2.
|
|
8938
|
+
const VERSION = "2.19.0";
|
|
8974
8939
|
|
|
8975
8940
|
/*
|
|
8976
8941
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|