@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
package/dist/zip-core.js
CHANGED
|
@@ -185,7 +185,6 @@
|
|
|
185
185
|
const OPTION_CHECK_AUTHENTICATION_CODE = "checkAuthenticationCode";
|
|
186
186
|
const OPTION_USE_WEB_WORKERS = "useWebWorkers";
|
|
187
187
|
const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
|
|
188
|
-
const OPTION_TRANSFER_STREAMS = "transferStreams";
|
|
189
188
|
const OPTION_PREVENT_CLOSE = "preventClose";
|
|
190
189
|
const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
|
|
191
190
|
const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
|
|
@@ -303,7 +302,7 @@
|
|
|
303
302
|
*/
|
|
304
303
|
|
|
305
304
|
|
|
306
|
-
const DEFAULT_CHUNK_SIZE$1 =
|
|
305
|
+
const DEFAULT_CHUNK_SIZE$1 = 256 * 1024;
|
|
307
306
|
const MINIMUM_CHUNK_SIZE = 64;
|
|
308
307
|
const MINIMUM_PROPERTY_VALUE = 1;
|
|
309
308
|
const ERR_INVALID_MAX_WORKERS = "Invalid maxWorkers (must be an integer greater than 0)";
|
|
@@ -2392,7 +2391,7 @@
|
|
|
2392
2391
|
*/
|
|
2393
2392
|
|
|
2394
2393
|
|
|
2395
|
-
const DEFAULT_CHUNK_SIZE =
|
|
2394
|
+
const DEFAULT_CHUNK_SIZE = 256 * 1024;
|
|
2396
2395
|
const MESSAGE_EVENT_TYPE = "message";
|
|
2397
2396
|
const MESSAGE_START = "start";
|
|
2398
2397
|
const MESSAGE_PULL = "pull";
|
|
@@ -2598,7 +2597,7 @@
|
|
|
2598
2597
|
class CodecWorker {
|
|
2599
2598
|
|
|
2600
2599
|
constructor(workerData, { readable, writable }, workerOptions, onTaskFinished) {
|
|
2601
|
-
const { options, config, streamOptions, useWebWorkers,
|
|
2600
|
+
const { options, config, streamOptions, useWebWorkers, workerURI } = workerOptions;
|
|
2602
2601
|
let { createWorker } = workerOptions;
|
|
2603
2602
|
const { signal } = streamOptions;
|
|
2604
2603
|
if (createWorkerFailed) {
|
|
@@ -2615,7 +2614,6 @@
|
|
|
2615
2614
|
workerOptions,
|
|
2616
2615
|
workerURI,
|
|
2617
2616
|
createWorker,
|
|
2618
|
-
transferStreams,
|
|
2619
2617
|
terminate() {
|
|
2620
2618
|
return new Promise(resolve => {
|
|
2621
2619
|
const { worker, busy } = workerData;
|
|
@@ -2793,12 +2791,6 @@
|
|
|
2793
2791
|
const ABORT_EVENT_TYPE = "abort";
|
|
2794
2792
|
|
|
2795
2793
|
let webWorkerSource, webWorkerURI, webWorkerOptions;
|
|
2796
|
-
let transferStreamsSupported = true;
|
|
2797
|
-
try {
|
|
2798
|
-
transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
|
|
2799
|
-
} catch {
|
|
2800
|
-
// ignored
|
|
2801
|
-
}
|
|
2802
2794
|
|
|
2803
2795
|
setWebWorkerBackend(createWebWorkerInterface);
|
|
2804
2796
|
|
|
@@ -2885,14 +2877,11 @@
|
|
|
2885
2877
|
});
|
|
2886
2878
|
const { readable, options } = workerData;
|
|
2887
2879
|
const { writable, closed, abortPipe } = watchClosedStream(workerData.writable, workerData);
|
|
2888
|
-
let streamsTransferred;
|
|
2889
2880
|
try {
|
|
2890
|
-
|
|
2881
|
+
sendMessage({
|
|
2891
2882
|
type: MESSAGE_START,
|
|
2892
2883
|
options,
|
|
2893
|
-
config
|
|
2894
|
-
readable,
|
|
2895
|
-
writable
|
|
2884
|
+
config
|
|
2896
2885
|
}, workerData);
|
|
2897
2886
|
} catch (error) {
|
|
2898
2887
|
abortPipe();
|
|
@@ -2904,12 +2893,10 @@
|
|
|
2904
2893
|
workerData.onTaskFinished();
|
|
2905
2894
|
throw error;
|
|
2906
2895
|
}
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
});
|
|
2912
|
-
}
|
|
2896
|
+
Object.assign(workerData, {
|
|
2897
|
+
reader: readable.getReader(),
|
|
2898
|
+
writer: writable.getWriter()
|
|
2899
|
+
});
|
|
2913
2900
|
const { workerStartupTimeout } = config;
|
|
2914
2901
|
if (!workerData.workerAlive && Number.isFinite(workerStartupTimeout) && workerStartupTimeout >= 0) {
|
|
2915
2902
|
workerData.startupTimeout = setTimeout(() => onStartupTimeout(workerData), workerStartupTimeout);
|
|
@@ -2942,7 +2929,7 @@
|
|
|
2942
2929
|
}
|
|
2943
2930
|
|
|
2944
2931
|
async function closeWritable() {
|
|
2945
|
-
if (!
|
|
2932
|
+
if (!writable.locked) {
|
|
2946
2933
|
try {
|
|
2947
2934
|
await writable.getWriter().close();
|
|
2948
2935
|
} catch {
|
|
@@ -3133,31 +3120,14 @@
|
|
|
3133
3120
|
}
|
|
3134
3121
|
}
|
|
3135
3122
|
|
|
3136
|
-
function sendMessage(message, { worker, writer
|
|
3123
|
+
function sendMessage(message, { worker, writer }) {
|
|
3137
3124
|
try {
|
|
3138
|
-
const { value
|
|
3139
|
-
const transferables = [];
|
|
3125
|
+
const { value } = message;
|
|
3140
3126
|
if (value) {
|
|
3141
3127
|
message.value = toExactUint8Array(value);
|
|
3142
|
-
transferables.push(message.value.buffer);
|
|
3143
|
-
}
|
|
3144
|
-
if (transferStreams && transferStreamsSupported && workerAlive) {
|
|
3145
|
-
if (readable) {
|
|
3146
|
-
transferables.push(readable);
|
|
3147
|
-
}
|
|
3148
|
-
if (writable) {
|
|
3149
|
-
transferables.push(writable);
|
|
3150
|
-
}
|
|
3151
|
-
} else {
|
|
3152
|
-
message.readable = message.writable = null;
|
|
3153
|
-
}
|
|
3154
|
-
if (transferables.length) {
|
|
3155
3128
|
try {
|
|
3156
|
-
worker.postMessage(message,
|
|
3157
|
-
return true;
|
|
3129
|
+
worker.postMessage(message, [message.value.buffer]);
|
|
3158
3130
|
} catch {
|
|
3159
|
-
transferStreamsSupported = false;
|
|
3160
|
-
message.readable = message.writable = null;
|
|
3161
3131
|
worker.postMessage(message);
|
|
3162
3132
|
}
|
|
3163
3133
|
} else {
|
|
@@ -3306,7 +3276,7 @@
|
|
|
3306
3276
|
|
|
3307
3277
|
async function runWorker(stream, workerOptions) {
|
|
3308
3278
|
const { options, config } = workerOptions;
|
|
3309
|
-
const {
|
|
3279
|
+
const { useWebWorkers, useCompressionStream, compressed, checkCrc32, computeCrc32, encrypted, format, codecURI } = options;
|
|
3310
3280
|
const { workerURI, createWorker, maxWorkers } = config;
|
|
3311
3281
|
if (format) {
|
|
3312
3282
|
if (codecURI) {
|
|
@@ -3314,7 +3284,6 @@
|
|
|
3314
3284
|
}
|
|
3315
3285
|
await ensureCodecStreams(format, options.codecURI);
|
|
3316
3286
|
}
|
|
3317
|
-
workerOptions.transferStreams = !format && (transferStreams || (transferStreams === UNDEFINED_VALUE && config.transferStreams));
|
|
3318
3287
|
const streamCopy = !compressed && !checkCrc32 && !computeCrc32 && !encrypted;
|
|
3319
3288
|
const workerSupported = format === UNDEFINED_VALUE || Boolean(options.codecURI);
|
|
3320
3289
|
workerOptions.useWebWorkers = !streamCopy && workerSupported && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
|
|
@@ -5096,17 +5065,6 @@
|
|
|
5096
5065
|
if (filename === UNDEFINED_VALUE) {
|
|
5097
5066
|
filename = decodeText(rawFilename, rawFilenameEncoding);
|
|
5098
5067
|
}
|
|
5099
|
-
if (normalizeFilename) {
|
|
5100
|
-
const normalizedFilename = normalizeFilename(filename);
|
|
5101
|
-
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5102
|
-
filename = normalizedFilename;
|
|
5103
|
-
}
|
|
5104
|
-
}
|
|
5105
|
-
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5106
|
-
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5107
|
-
error.filename = filename;
|
|
5108
|
-
throw error;
|
|
5109
|
-
}
|
|
5110
5068
|
let comment = decode(rawComment, rawCommentEncoding, TEXT_TYPE_COMMENT);
|
|
5111
5069
|
if (comment === UNDEFINED_VALUE) {
|
|
5112
5070
|
comment = decodeText(rawComment, rawCommentEncoding);
|
|
@@ -5134,7 +5092,20 @@
|
|
|
5134
5092
|
filename,
|
|
5135
5093
|
comment
|
|
5136
5094
|
});
|
|
5137
|
-
|
|
5095
|
+
const malformedExtraField = readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
5096
|
+
filename = fileEntry.filename;
|
|
5097
|
+
if (normalizeFilename) {
|
|
5098
|
+
const normalizedFilename = normalizeFilename(filename);
|
|
5099
|
+
if (normalizedFilename !== UNDEFINED_VALUE) {
|
|
5100
|
+
filename = fileEntry.filename = normalizedFilename;
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
if (isUnsafeFilename(filename, filenameValidation)) {
|
|
5104
|
+
const error = new Error(ERR_UNSAFE_FILENAME);
|
|
5105
|
+
error.filename = filename;
|
|
5106
|
+
throw error;
|
|
5107
|
+
}
|
|
5108
|
+
if (malformedExtraField) {
|
|
5138
5109
|
addWarning(warnings, WARNING_MALFORMED_EXTRA_FIELD, filename);
|
|
5139
5110
|
}
|
|
5140
5111
|
fileEntry.offset += prependedDataLength;
|
|
@@ -5538,7 +5509,6 @@
|
|
|
5538
5509
|
encrypted,
|
|
5539
5510
|
useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
|
|
5540
5511
|
useCompressionStream,
|
|
5541
|
-
transferStreams: getOptionValue$1(zipEntry, options, OPTION_TRANSFER_STREAMS),
|
|
5542
5512
|
deflate64,
|
|
5543
5513
|
format: registeredCodec ? registeredCodec.format : UNDEFINED_VALUE,
|
|
5544
5514
|
codecURI: registeredCodec ? registeredCodec.codecURI : UNDEFINED_VALUE,
|
|
@@ -5768,19 +5738,17 @@
|
|
|
5768
5738
|
readExtraFieldNTFS(extraFieldNTFS, directory);
|
|
5769
5739
|
directory.extraFieldNTFS = extraFieldNTFS;
|
|
5770
5740
|
}
|
|
5771
|
-
const
|
|
5741
|
+
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5772
5742
|
let unixIdsRead;
|
|
5743
|
+
if (extraFieldInfoZip) {
|
|
5744
|
+
unixIdsRead = readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5745
|
+
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5746
|
+
}
|
|
5747
|
+
const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
|
|
5773
5748
|
if (extraFieldUnix) {
|
|
5774
|
-
|
|
5749
|
+
readExtraFieldUnix(extraFieldUnix, unixIdsRead ? {} : directory, false);
|
|
5775
5750
|
directory.extraFieldUnix = extraFieldUnix;
|
|
5776
5751
|
}
|
|
5777
|
-
if (!unixIdsRead) {
|
|
5778
|
-
const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
|
|
5779
|
-
if (extraFieldInfoZip) {
|
|
5780
|
-
readExtraFieldUnix(extraFieldInfoZip, directory, true);
|
|
5781
|
-
directory.extraFieldInfoZip = extraFieldInfoZip;
|
|
5782
|
-
}
|
|
5783
|
-
}
|
|
5784
5752
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
5785
5753
|
if (extraFieldExtendedTimestamp) {
|
|
5786
5754
|
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
@@ -6006,19 +5974,11 @@
|
|
|
6006
5974
|
const zip64 = Boolean(extraFieldZip64);
|
|
6007
5975
|
const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH);
|
|
6008
5976
|
const dataDescriptorView = getDataView(dataDescriptorArray);
|
|
6009
|
-
const
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize) {
|
|
6015
|
-
localDataDescriptor = candidate;
|
|
6016
|
-
break;
|
|
6017
|
-
}
|
|
6018
|
-
}
|
|
6019
|
-
if (!localDataDescriptor) {
|
|
6020
|
-
localDataDescriptor = readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6021
|
-
}
|
|
5977
|
+
const candidates = [[zip64, true], [zip64, false], [!zip64, true], [!zip64, false]]
|
|
5978
|
+
.map(([zip64Layout, signature]) => readDataDescriptor(dataDescriptorView, zip64Layout, signature))
|
|
5979
|
+
.filter(candidate => candidate && candidate.compressedSize == compressedSize && candidate.uncompressedSize == uncompressedSize);
|
|
5980
|
+
const localDataDescriptor = candidates.find(candidate => candidate.crc32 == crc32) || candidates[0] ||
|
|
5981
|
+
readDataDescriptor(dataDescriptorView, zip64, true) || readDataDescriptor(dataDescriptorView, zip64, false);
|
|
6022
5982
|
if (localDataDescriptor) {
|
|
6023
5983
|
fileEntry.localDirectory.dataDescriptor = localDataDescriptor;
|
|
6024
5984
|
dataDescriptorLength = getDataDescriptorLength(localDataDescriptor.zip64, localDataDescriptor.signature);
|
|
@@ -6675,6 +6635,7 @@
|
|
|
6675
6635
|
rawExtraFieldExtendedTimestamp: EMPTY_UINT8_ARRAY,
|
|
6676
6636
|
rawExtraFieldNTFS: EMPTY_UINT8_ARRAY,
|
|
6677
6637
|
rawExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6638
|
+
rawCentralExtraFieldUnix: EMPTY_UINT8_ARRAY,
|
|
6678
6639
|
rawExtraField,
|
|
6679
6640
|
rawCentralExtraField: EMPTY_UINT8_ARRAY,
|
|
6680
6641
|
headerArray,
|
|
@@ -7243,7 +7204,6 @@
|
|
|
7243
7204
|
const ntfsTimestamp = getOptionValue(zipWriter, options, OPTION_NTFS_TIMESTAMP);
|
|
7244
7205
|
const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
|
|
7245
7206
|
const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
|
|
7246
|
-
const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS);
|
|
7247
7207
|
const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
|
|
7248
7208
|
const createTempStream = getFunctionOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
|
|
7249
7209
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, true);
|
|
@@ -7309,7 +7269,6 @@
|
|
|
7309
7269
|
ntfsTimestamp,
|
|
7310
7270
|
keepOrder,
|
|
7311
7271
|
useWebWorkers,
|
|
7312
|
-
transferStreams,
|
|
7313
7272
|
bufferedWrite,
|
|
7314
7273
|
createTempStream,
|
|
7315
7274
|
dataDescriptorSignature,
|
|
@@ -7368,7 +7327,7 @@
|
|
|
7368
7327
|
if (reader) {
|
|
7369
7328
|
reader = new GenericReader(reader);
|
|
7370
7329
|
await initStream(reader);
|
|
7371
|
-
if (!reader.
|
|
7330
|
+
if (!reader.readUint8Array && !reader.readable) {
|
|
7372
7331
|
throw new Error(ERR_INVALID_READER);
|
|
7373
7332
|
}
|
|
7374
7333
|
({ size: contentSize } = reader);
|
|
@@ -7631,6 +7590,7 @@
|
|
|
7631
7590
|
extraFieldExtendedTimestampTime,
|
|
7632
7591
|
rawExtraFieldNTFS,
|
|
7633
7592
|
rawExtraFieldUnix,
|
|
7593
|
+
rawCentralExtraFieldUnix,
|
|
7634
7594
|
rawExtraFieldAES,
|
|
7635
7595
|
} = headerInfo;
|
|
7636
7596
|
const { dataDescriptorArray } = dataDescriptorInfo;
|
|
@@ -7655,7 +7615,6 @@
|
|
|
7655
7615
|
rawExtraField,
|
|
7656
7616
|
rawCentralExtraField,
|
|
7657
7617
|
useWebWorkers,
|
|
7658
|
-
transferStreams,
|
|
7659
7618
|
onstart,
|
|
7660
7619
|
onprogress,
|
|
7661
7620
|
onend,
|
|
@@ -7697,6 +7656,7 @@
|
|
|
7697
7656
|
rawExtraFieldExtendedTimestamp,
|
|
7698
7657
|
rawExtraFieldNTFS,
|
|
7699
7658
|
rawExtraFieldUnix,
|
|
7659
|
+
rawCentralExtraFieldUnix,
|
|
7700
7660
|
rawExtraFieldAES,
|
|
7701
7661
|
rawExtraField,
|
|
7702
7662
|
rawCentralExtraField,
|
|
@@ -7743,7 +7703,6 @@
|
|
|
7743
7703
|
encrypted: encrypted && !passThroughEncryption,
|
|
7744
7704
|
useWebWorkers,
|
|
7745
7705
|
useCompressionStream,
|
|
7746
|
-
transferStreams,
|
|
7747
7706
|
format,
|
|
7748
7707
|
codecURI,
|
|
7749
7708
|
compressionMethod
|
|
@@ -7921,6 +7880,7 @@
|
|
|
7921
7880
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = EMPTY_UINT8_ARRAY;
|
|
7922
7881
|
}
|
|
7923
7882
|
let rawExtraFieldUnix;
|
|
7883
|
+
let rawCentralExtraFieldUnix;
|
|
7924
7884
|
try {
|
|
7925
7885
|
const { uid, gid, unixExtraFieldType } = options;
|
|
7926
7886
|
if (unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
@@ -7935,7 +7895,7 @@
|
|
|
7935
7895
|
extraFieldUnix.writeBytes(uidBytes);
|
|
7936
7896
|
extraFieldUnix.writeUint8(gidBytes.length);
|
|
7937
7897
|
extraFieldUnix.writeBytes(gidBytes);
|
|
7938
|
-
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7898
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = extraFieldUnix.array;
|
|
7939
7899
|
} else if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE)) {
|
|
7940
7900
|
const extraFieldUnix = createRecordWriter(8);
|
|
7941
7901
|
extraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
@@ -7943,11 +7903,15 @@
|
|
|
7943
7903
|
extraFieldUnix.writeUint16((uid === UNDEFINED_VALUE ? 0 : uid) & MAX_16_BITS);
|
|
7944
7904
|
extraFieldUnix.writeUint16((gid === UNDEFINED_VALUE ? 0 : gid) & MAX_16_BITS);
|
|
7945
7905
|
rawExtraFieldUnix = extraFieldUnix.array;
|
|
7906
|
+
const centralExtraFieldUnix = createRecordWriter(4);
|
|
7907
|
+
centralExtraFieldUnix.writeUint16(EXTRAFIELD_TYPE_UNIX);
|
|
7908
|
+
centralExtraFieldUnix.writeUint16(0);
|
|
7909
|
+
rawCentralExtraFieldUnix = centralExtraFieldUnix.array;
|
|
7946
7910
|
} else {
|
|
7947
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7911
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7948
7912
|
}
|
|
7949
7913
|
} catch {
|
|
7950
|
-
rawExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7914
|
+
rawExtraFieldUnix = rawCentralExtraFieldUnix = EMPTY_UINT8_ARRAY;
|
|
7951
7915
|
}
|
|
7952
7916
|
if (compressionMethod === UNDEFINED_VALUE) {
|
|
7953
7917
|
compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
|
|
@@ -8039,6 +8003,7 @@
|
|
|
8039
8003
|
rawExtraFieldExtendedTimestamp,
|
|
8040
8004
|
rawExtraFieldNTFS,
|
|
8041
8005
|
rawExtraFieldUnix,
|
|
8006
|
+
rawCentralExtraFieldUnix,
|
|
8042
8007
|
rawExtraFieldAES,
|
|
8043
8008
|
extraFieldLength
|
|
8044
8009
|
};
|
|
@@ -8214,7 +8179,7 @@
|
|
|
8214
8179
|
rawExtraFieldAES,
|
|
8215
8180
|
rawComment,
|
|
8216
8181
|
rawExtraFieldNTFS,
|
|
8217
|
-
|
|
8182
|
+
rawCentralExtraFieldUnix,
|
|
8218
8183
|
rawExtraField,
|
|
8219
8184
|
rawCentralExtraField,
|
|
8220
8185
|
extraFieldExtendedTimestampFlag,
|
|
@@ -8276,7 +8241,7 @@
|
|
|
8276
8241
|
rawExtraFieldZip64,
|
|
8277
8242
|
rawExtraFieldAES,
|
|
8278
8243
|
rawExtraFieldNTFS,
|
|
8279
|
-
|
|
8244
|
+
rawCentralExtraFieldUnix,
|
|
8280
8245
|
rawExtraFieldTimestamp,
|
|
8281
8246
|
rawExtraField,
|
|
8282
8247
|
rawCentralExtraField);
|
|
@@ -8305,7 +8270,7 @@
|
|
|
8305
8270
|
rawExtraFieldAES,
|
|
8306
8271
|
rawExtraFieldExtendedTimestamp,
|
|
8307
8272
|
rawExtraFieldNTFS,
|
|
8308
|
-
|
|
8273
|
+
rawCentralExtraFieldUnix,
|
|
8309
8274
|
rawExtraField,
|
|
8310
8275
|
rawCentralExtraField,
|
|
8311
8276
|
rawComment,
|
|
@@ -8322,7 +8287,7 @@
|
|
|
8322
8287
|
uncompressedSize,
|
|
8323
8288
|
compressedSize
|
|
8324
8289
|
} = fileEntry;
|
|
8325
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS,
|
|
8290
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawCentralExtraFieldUnix, rawExtraField, rawCentralExtraField);
|
|
8326
8291
|
const directoryRecordLength = CENTRAL_FILE_HEADER_LENGTH + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
8327
8292
|
if (exceedsAvailableSize(writer, offset + directoryRecordLength - directoryDiskOffset)) {
|
|
8328
8293
|
await writeData(writer, directoryArray.slice(directoryDiskOffset, offset));
|
|
@@ -8358,7 +8323,7 @@
|
|
|
8358
8323
|
directoryRecord.writeBytes(rawExtraFieldAES);
|
|
8359
8324
|
directoryRecord.writeBytes(rawExtraFieldExtendedTimestamp);
|
|
8360
8325
|
directoryRecord.writeBytes(rawExtraFieldNTFS);
|
|
8361
|
-
directoryRecord.writeBytes(
|
|
8326
|
+
directoryRecord.writeBytes(rawCentralExtraFieldUnix);
|
|
8362
8327
|
directoryRecord.writeBytes(rawExtraField);
|
|
8363
8328
|
directoryRecord.writeBytes(rawCentralExtraField);
|
|
8364
8329
|
directoryRecord.writeBytes(rawComment);
|
|
@@ -8935,7 +8900,7 @@
|
|
|
8935
8900
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
8936
8901
|
*/
|
|
8937
8902
|
|
|
8938
|
-
const VERSION = "2.
|
|
8903
|
+
const VERSION = "2.19.0";
|
|
8939
8904
|
|
|
8940
8905
|
/*
|
|
8941
8906
|
Copyright (c) 2025 Gildas Lormeau. All rights reserved.
|