@zip.js/zip.js 2.7.47 → 2.7.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/zip-fs-full.js +100 -31
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +100 -31
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +76 -28
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +76 -28
- package/dist/zip.min.js +1 -1
- package/index.cjs +100 -31
- package/index.d.ts +44 -21
- package/index.js +1 -0
- package/index.min.js +1 -1
- package/lib/core/zip-entry.js +1 -1
- package/lib/core/zip-fs-core.js +24 -3
- package/lib/core/zip-reader.js +9 -4
- package/lib/core/zip-writer.js +68 -25
- package/package.json +3 -3
package/index.cjs
CHANGED
|
@@ -9205,7 +9205,7 @@ const PROPERTY_NAMES = [
|
|
|
9205
9205
|
PROPERTY_NAME_MS_DOS_COMPATIBLE, PROPERTY_NAME_ZIP64,
|
|
9206
9206
|
"directory", "bitFlag", "encrypted", "signature", "filenameUTF8", "commentUTF8", "compressionMethod", "version", "versionMadeBy",
|
|
9207
9207
|
"extraField", "rawExtraField", "extraFieldZip64", "extraFieldUnicodePath", "extraFieldUnicodeComment", "extraFieldAES", "extraFieldNTFS",
|
|
9208
|
-
"extraFieldExtendedTimestamp"];
|
|
9208
|
+
"extraFieldExtendedTimestamp", "zipCrypto"];
|
|
9209
9209
|
|
|
9210
9210
|
class Entry {
|
|
9211
9211
|
|
|
@@ -9440,6 +9440,7 @@ class ZipReader {
|
|
|
9440
9440
|
});
|
|
9441
9441
|
startOffset = Math.max(offsetFileEntry, startOffset);
|
|
9442
9442
|
await readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
|
|
9443
|
+
fileEntry.zipCrypto = fileEntry.encrypted && !fileEntry.extraFieldAES;
|
|
9443
9444
|
const entry = new Entry(fileEntry);
|
|
9444
9445
|
entry.getData = (writer, options) => fileEntry.getData(writer, entry, options);
|
|
9445
9446
|
offset = endOffset;
|
|
@@ -9557,8 +9558,12 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
9557
9558
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
9558
9559
|
creationDate: localDirectory.creationDate
|
|
9559
9560
|
});
|
|
9560
|
-
const
|
|
9561
|
+
const passThrough = getOptionValue$1(zipEntry, options, "passThrough");
|
|
9562
|
+
const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
|
|
9561
9563
|
const zipCrypto = encrypted && !extraFieldAES;
|
|
9564
|
+
if (!passThrough) {
|
|
9565
|
+
fileEntry.zipCrypto = zipCrypto;
|
|
9566
|
+
}
|
|
9562
9567
|
if (encrypted) {
|
|
9563
9568
|
if (!zipCrypto && extraFieldAES.strength === UNDEFINED_VALUE) {
|
|
9564
9569
|
throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
|
|
@@ -9590,11 +9595,11 @@ let ZipEntry$1 = class ZipEntry {
|
|
|
9590
9595
|
rawPassword,
|
|
9591
9596
|
zipCrypto,
|
|
9592
9597
|
encryptionStrength: extraFieldAES && extraFieldAES.strength,
|
|
9593
|
-
signed: getOptionValue$1(zipEntry, options, "checkSignature"),
|
|
9598
|
+
signed: getOptionValue$1(zipEntry, options, "checkSignature") && !passThrough,
|
|
9594
9599
|
passwordVerification: zipCrypto && (bitFlag.dataDescriptor ? ((rawLastModDate >>> 8) & 0xFF) : ((signature >>> 24) & 0xFF)),
|
|
9595
9600
|
signature,
|
|
9596
|
-
compressed: compressionMethod != 0,
|
|
9597
|
-
encrypted,
|
|
9601
|
+
compressed: compressionMethod != 0 && !passThrough,
|
|
9602
|
+
encrypted: zipEntry.encrypted && !passThrough,
|
|
9598
9603
|
useWebWorkers: getOptionValue$1(zipEntry, options, "useWebWorkers"),
|
|
9599
9604
|
useCompressionStream: getOptionValue$1(zipEntry, options, "useCompressionStream"),
|
|
9600
9605
|
transferStreams: getOptionValue$1(zipEntry, options, "transferStreams"),
|
|
@@ -9923,6 +9928,7 @@ const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
|
|
|
9923
9928
|
const ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535";
|
|
9924
9929
|
const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
|
|
9925
9930
|
const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (make sure 'keepOrder' is set to 'true')";
|
|
9931
|
+
const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
|
|
9926
9932
|
|
|
9927
9933
|
const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
|
|
9928
9934
|
|
|
@@ -10065,8 +10071,12 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
10065
10071
|
const msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE, true);
|
|
10066
10072
|
const internalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTE, 0);
|
|
10067
10073
|
const externalFileAttribute = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTE, 0);
|
|
10068
|
-
const
|
|
10069
|
-
|
|
10074
|
+
const passThrough = getOptionValue(zipWriter, options, "passThrough");
|
|
10075
|
+
let password, rawPassword;
|
|
10076
|
+
if (!passThrough) {
|
|
10077
|
+
password = getOptionValue(zipWriter, options, "password");
|
|
10078
|
+
rawPassword = getOptionValue(zipWriter, options, "rawPassword");
|
|
10079
|
+
}
|
|
10070
10080
|
const encryptionStrength = getOptionValue(zipWriter, options, "encryptionStrength", 3);
|
|
10071
10081
|
const zipCrypto = getOptionValue(zipWriter, options, "zipCrypto");
|
|
10072
10082
|
const extendedTimestamp = getOptionValue(zipWriter, options, "extendedTimestamp", true);
|
|
@@ -10076,10 +10086,11 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
10076
10086
|
const bufferedWrite = getOptionValue(zipWriter, options, "bufferedWrite");
|
|
10077
10087
|
const dataDescriptorSignature = getOptionValue(zipWriter, options, "dataDescriptorSignature", false);
|
|
10078
10088
|
const signal = getOptionValue(zipWriter, options, "signal");
|
|
10089
|
+
const useUnicodeFileNames = getOptionValue(zipWriter, options, "useUnicodeFileNames", true);
|
|
10079
10090
|
const useCompressionStream = getOptionValue(zipWriter, options, "useCompressionStream");
|
|
10080
10091
|
let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor", true);
|
|
10081
10092
|
let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
|
|
10082
|
-
if (password !== UNDEFINED_VALUE && encryptionStrength !== UNDEFINED_VALUE && (encryptionStrength < 1 || encryptionStrength > 3)) {
|
|
10093
|
+
if ((password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && encryptionStrength !== UNDEFINED_VALUE && (encryptionStrength < 1 || encryptionStrength > 3)) {
|
|
10083
10094
|
throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
|
|
10084
10095
|
}
|
|
10085
10096
|
let rawExtraField = new Uint8Array();
|
|
@@ -10105,18 +10116,28 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
10105
10116
|
let maximumCompressedSize = 0;
|
|
10106
10117
|
let maximumEntrySize = 0;
|
|
10107
10118
|
let uncompressedSize = 0;
|
|
10119
|
+
if (passThrough) {
|
|
10120
|
+
({ uncompressedSize } = options);
|
|
10121
|
+
if (uncompressedSize === UNDEFINED_VALUE) {
|
|
10122
|
+
throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
|
|
10123
|
+
}
|
|
10124
|
+
}
|
|
10108
10125
|
const zip64Enabled = zip64 === true;
|
|
10109
10126
|
if (reader) {
|
|
10110
10127
|
reader = initReader(reader);
|
|
10111
10128
|
await initStream(reader);
|
|
10112
|
-
if (
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
zip64
|
|
10116
|
-
|
|
10129
|
+
if (!passThrough) {
|
|
10130
|
+
if (reader.size === UNDEFINED_VALUE) {
|
|
10131
|
+
dataDescriptor = true;
|
|
10132
|
+
if (zip64 || zip64 === UNDEFINED_VALUE) {
|
|
10133
|
+
zip64 = true;
|
|
10134
|
+
uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
|
|
10135
|
+
}
|
|
10136
|
+
} else {
|
|
10137
|
+
uncompressedSize = reader.size;
|
|
10138
|
+
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
|
|
10117
10139
|
}
|
|
10118
10140
|
} else {
|
|
10119
|
-
uncompressedSize = reader.size;
|
|
10120
10141
|
maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
|
|
10121
10142
|
}
|
|
10122
10143
|
}
|
|
@@ -10134,6 +10155,8 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
10134
10155
|
}
|
|
10135
10156
|
}
|
|
10136
10157
|
zip64 = zip64 || false;
|
|
10158
|
+
const encrypted = getOptionValue(zipWriter, options, "encrypted");
|
|
10159
|
+
const { signature } = options;
|
|
10137
10160
|
options = Object.assign({}, options, {
|
|
10138
10161
|
rawFilename,
|
|
10139
10162
|
rawComment,
|
|
@@ -10157,13 +10180,17 @@ async function addFile(zipWriter, name, reader, options) {
|
|
|
10157
10180
|
zipCrypto,
|
|
10158
10181
|
bufferedWrite,
|
|
10159
10182
|
keepOrder,
|
|
10183
|
+
useUnicodeFileNames,
|
|
10160
10184
|
dataDescriptor,
|
|
10161
10185
|
dataDescriptorSignature,
|
|
10162
10186
|
signal,
|
|
10163
10187
|
msDosCompatible,
|
|
10164
10188
|
internalFileAttribute,
|
|
10165
10189
|
externalFileAttribute,
|
|
10166
|
-
useCompressionStream
|
|
10190
|
+
useCompressionStream,
|
|
10191
|
+
passThrough,
|
|
10192
|
+
encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
|
|
10193
|
+
signature
|
|
10167
10194
|
});
|
|
10168
10195
|
const headerInfo = getHeaderInfo(options);
|
|
10169
10196
|
const dataDescriptorInfo = getDataDescriptorInfo(options);
|
|
@@ -10374,7 +10401,8 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10374
10401
|
msDosCompatible,
|
|
10375
10402
|
internalFileAttribute,
|
|
10376
10403
|
externalFileAttribute,
|
|
10377
|
-
useCompressionStream
|
|
10404
|
+
useCompressionStream,
|
|
10405
|
+
passThrough
|
|
10378
10406
|
} = options;
|
|
10379
10407
|
const fileEntry = {
|
|
10380
10408
|
lock,
|
|
@@ -10395,9 +10423,14 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10395
10423
|
externalFileAttribute,
|
|
10396
10424
|
diskNumberStart
|
|
10397
10425
|
};
|
|
10426
|
+
let {
|
|
10427
|
+
signature,
|
|
10428
|
+
uncompressedSize
|
|
10429
|
+
} = options;
|
|
10398
10430
|
let compressedSize = 0;
|
|
10399
|
-
|
|
10400
|
-
|
|
10431
|
+
if (!passThrough) {
|
|
10432
|
+
uncompressedSize = 0;
|
|
10433
|
+
}
|
|
10401
10434
|
const { writable } = writer;
|
|
10402
10435
|
if (reader) {
|
|
10403
10436
|
reader.chunkSize = getChunkSize(config);
|
|
@@ -10413,9 +10446,9 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10413
10446
|
encryptionStrength,
|
|
10414
10447
|
zipCrypto: encrypted && zipCrypto,
|
|
10415
10448
|
passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & 0xFF,
|
|
10416
|
-
signed:
|
|
10417
|
-
compressed,
|
|
10418
|
-
encrypted,
|
|
10449
|
+
signed: !passThrough,
|
|
10450
|
+
compressed: compressed && !passThrough,
|
|
10451
|
+
encrypted: encrypted && !passThrough,
|
|
10419
10452
|
useWebWorkers,
|
|
10420
10453
|
useCompressionStream,
|
|
10421
10454
|
transferStreams: false
|
|
@@ -10424,9 +10457,11 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10424
10457
|
streamOptions: { signal, size, onstart, onprogress, onend }
|
|
10425
10458
|
};
|
|
10426
10459
|
const result = await runWorker({ readable, writable }, workerOptions);
|
|
10427
|
-
uncompressedSize = result.inputSize;
|
|
10428
10460
|
compressedSize = result.outputSize;
|
|
10429
|
-
|
|
10461
|
+
if (!passThrough) {
|
|
10462
|
+
uncompressedSize = result.inputSize;
|
|
10463
|
+
signature = result.signature;
|
|
10464
|
+
}
|
|
10430
10465
|
writable.size += uncompressedSize;
|
|
10431
10466
|
} else {
|
|
10432
10467
|
await writeData(writable, localHeaderArray);
|
|
@@ -10469,6 +10504,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10469
10504
|
creationDate,
|
|
10470
10505
|
lastAccessDate,
|
|
10471
10506
|
encrypted,
|
|
10507
|
+
zipCrypto,
|
|
10472
10508
|
size: metadataSize + compressedSize,
|
|
10473
10509
|
compressionMethod,
|
|
10474
10510
|
version,
|
|
@@ -10490,19 +10526,18 @@ function getHeaderInfo(options) {
|
|
|
10490
10526
|
lastModDate,
|
|
10491
10527
|
lastAccessDate,
|
|
10492
10528
|
creationDate,
|
|
10493
|
-
rawPassword,
|
|
10494
|
-
password,
|
|
10495
10529
|
level,
|
|
10496
10530
|
zip64,
|
|
10497
10531
|
zipCrypto,
|
|
10532
|
+
useUnicodeFileNames,
|
|
10498
10533
|
dataDescriptor,
|
|
10499
10534
|
directory,
|
|
10500
10535
|
rawExtraField,
|
|
10501
10536
|
encryptionStrength,
|
|
10502
|
-
extendedTimestamp
|
|
10537
|
+
extendedTimestamp,
|
|
10538
|
+
encrypted
|
|
10503
10539
|
} = options;
|
|
10504
10540
|
const compressed = level !== 0 && !directory;
|
|
10505
|
-
const encrypted = Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword)));
|
|
10506
10541
|
let version = options.version;
|
|
10507
10542
|
let rawExtraFieldAES;
|
|
10508
10543
|
if (encrypted && !zipCrypto) {
|
|
@@ -10551,13 +10586,25 @@ function getHeaderInfo(options) {
|
|
|
10551
10586
|
} else {
|
|
10552
10587
|
rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array();
|
|
10553
10588
|
}
|
|
10554
|
-
let bitFlag =
|
|
10589
|
+
let bitFlag = 0;
|
|
10590
|
+
if (useUnicodeFileNames) {
|
|
10591
|
+
bitFlag = bitFlag | BITFLAG_LANG_ENCODING_FLAG;
|
|
10592
|
+
}
|
|
10555
10593
|
if (dataDescriptor) {
|
|
10556
10594
|
bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
|
|
10557
10595
|
}
|
|
10558
10596
|
let compressionMethod = COMPRESSION_METHOD_STORE;
|
|
10559
10597
|
if (compressed) {
|
|
10560
10598
|
compressionMethod = COMPRESSION_METHOD_DEFLATE;
|
|
10599
|
+
if (level >= 1 && level < 3) {
|
|
10600
|
+
bitFlag = bitFlag | 0b110;
|
|
10601
|
+
}
|
|
10602
|
+
if (level >= 3 && level < 5) {
|
|
10603
|
+
bitFlag = bitFlag | 0b01;
|
|
10604
|
+
}
|
|
10605
|
+
if (level === 9) {
|
|
10606
|
+
bitFlag = bitFlag | 0b10;
|
|
10607
|
+
}
|
|
10561
10608
|
}
|
|
10562
10609
|
if (zip64) {
|
|
10563
10610
|
version = version > VERSION_ZIP64 ? version : VERSION_ZIP64;
|
|
@@ -11043,7 +11090,8 @@ class ZipEntry {
|
|
|
11043
11090
|
id: fs.entries.length,
|
|
11044
11091
|
parent,
|
|
11045
11092
|
children: [],
|
|
11046
|
-
uncompressedSize: params.uncompressedSize || 0
|
|
11093
|
+
uncompressedSize: params.uncompressedSize || 0,
|
|
11094
|
+
passThrough: params.passThrough
|
|
11047
11095
|
});
|
|
11048
11096
|
fs.entries.push(zipEntry);
|
|
11049
11097
|
if (parent) {
|
|
@@ -11386,7 +11434,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
11386
11434
|
importedEntries.push(addChild(parent, name, {
|
|
11387
11435
|
data: entry,
|
|
11388
11436
|
Reader: getZipBlobReader(Object.assign({}, options)),
|
|
11389
|
-
uncompressedSize: entry.uncompressedSize
|
|
11437
|
+
uncompressedSize: entry.uncompressedSize,
|
|
11438
|
+
passThrough: options.passThrough
|
|
11390
11439
|
}));
|
|
11391
11440
|
}
|
|
11392
11441
|
} catch (error) {
|
|
@@ -11702,8 +11751,17 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
11702
11751
|
comment,
|
|
11703
11752
|
lastModDate,
|
|
11704
11753
|
creationDate,
|
|
11705
|
-
lastAccessDate
|
|
11754
|
+
lastAccessDate,
|
|
11755
|
+
uncompressedSize,
|
|
11756
|
+
encrypted,
|
|
11757
|
+
zipCrypto,
|
|
11758
|
+
signature,
|
|
11759
|
+
compressionMethod
|
|
11706
11760
|
} = child.data;
|
|
11761
|
+
let level;
|
|
11762
|
+
if (compressionMethod === 0) {
|
|
11763
|
+
level = 0;
|
|
11764
|
+
}
|
|
11707
11765
|
zipEntryOptions = {
|
|
11708
11766
|
externalFileAttribute,
|
|
11709
11767
|
versionMadeBy,
|
|
@@ -11712,6 +11770,16 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
11712
11770
|
creationDate,
|
|
11713
11771
|
lastAccessDate
|
|
11714
11772
|
};
|
|
11773
|
+
if (child.passThrough) {
|
|
11774
|
+
zipEntryOptions = Object.assign(zipEntryOptions, {
|
|
11775
|
+
passThrough: true,
|
|
11776
|
+
encrypted,
|
|
11777
|
+
zipCrypto,
|
|
11778
|
+
signature,
|
|
11779
|
+
uncompressedSize,
|
|
11780
|
+
level
|
|
11781
|
+
});
|
|
11782
|
+
}
|
|
11715
11783
|
}
|
|
11716
11784
|
await zipWriter.add(name, child.reader, Object.assign({
|
|
11717
11785
|
directory: child.directory
|
|
@@ -11901,6 +11969,7 @@ exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
|
|
|
11901
11969
|
exports.ERR_ITERATOR_COMPLETED_TOO_SOON = ERR_ITERATOR_COMPLETED_TOO_SOON;
|
|
11902
11970
|
exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
|
|
11903
11971
|
exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
|
|
11972
|
+
exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
|
|
11904
11973
|
exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
|
|
11905
11974
|
exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
|
|
11906
11975
|
exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
|
package/index.d.ts
CHANGED
|
@@ -800,19 +800,13 @@ export interface GetEntriesOptions {
|
|
|
800
800
|
/**
|
|
801
801
|
* Represents options passed to the constructor of {@link ZipReader} and {@link Entry#getData}.
|
|
802
802
|
*/
|
|
803
|
-
export interface
|
|
803
|
+
export interface ZipReaderOptions {
|
|
804
804
|
/**
|
|
805
805
|
* `true` to check only if the password is valid.
|
|
806
806
|
*
|
|
807
807
|
* @defaultValue false
|
|
808
808
|
*/
|
|
809
809
|
checkPasswordOnly: boolean;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
/**
|
|
813
|
-
* Represents options passed to the constructor of {@link ZipReader} and {@link Entry#getData}.
|
|
814
|
-
*/
|
|
815
|
-
export interface ZipReaderOptions {
|
|
816
810
|
/**
|
|
817
811
|
* `true` to check the signature of the entry.
|
|
818
812
|
*
|
|
@@ -823,6 +817,10 @@ export interface ZipReaderOptions {
|
|
|
823
817
|
* The password used to decrypt the content of the entry.
|
|
824
818
|
*/
|
|
825
819
|
password?: string;
|
|
820
|
+
/**
|
|
821
|
+
* `true` to read the data as-is without decompressing it and without decrypting it.
|
|
822
|
+
*/
|
|
823
|
+
passThrough?: boolean;
|
|
826
824
|
/**
|
|
827
825
|
* The password used to encrypt the content of the entry (raw).
|
|
828
826
|
*/
|
|
@@ -873,6 +871,10 @@ export interface EntryMetaData {
|
|
|
873
871
|
* `true` if the content of the entry is encrypted.
|
|
874
872
|
*/
|
|
875
873
|
encrypted: boolean;
|
|
874
|
+
/**
|
|
875
|
+
* `true` if the content of the entry is encrypted with the ZipCrypto algorithm.
|
|
876
|
+
*/
|
|
877
|
+
zipCrypto: boolean;
|
|
876
878
|
/**
|
|
877
879
|
* The size of the compressed data in bytes.
|
|
878
880
|
*/
|
|
@@ -979,19 +981,8 @@ export interface Entry extends EntryMetaData {
|
|
|
979
981
|
Writer<unknown> | WritableWriter | WritableStream,
|
|
980
982
|
boolean
|
|
981
983
|
>,
|
|
982
|
-
options?:
|
|
984
|
+
options?: EntryGetDataCheckPasswordOptions
|
|
983
985
|
): Promise<Type>;
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Tests if the password is valid.
|
|
987
|
-
*
|
|
988
|
-
* @param writer `undefined` or `null`.
|
|
989
|
-
* @param options The options with `checkPasswordOnly` set to `true`.
|
|
990
|
-
*/
|
|
991
|
-
getData?(
|
|
992
|
-
writer: undefined | null,
|
|
993
|
-
options: EntryGetDataCheckPasswordOptions,
|
|
994
|
-
): Promise<void>;
|
|
995
986
|
}
|
|
996
987
|
|
|
997
988
|
/**
|
|
@@ -1004,7 +995,7 @@ export interface EntryGetDataOptions
|
|
|
1004
995
|
* Represents the options passed to {@link Entry#getData} and `{@link ZipFileEntry}.get*`.
|
|
1005
996
|
*/
|
|
1006
997
|
export interface EntryGetDataCheckPasswordOptions
|
|
1007
|
-
extends EntryGetDataOptions
|
|
998
|
+
extends EntryGetDataOptions { }
|
|
1008
999
|
|
|
1009
1000
|
/**
|
|
1010
1001
|
* Represents an instance used to create a zipped stream.
|
|
@@ -1184,6 +1175,14 @@ export interface ZipWriterAddDataOptions
|
|
|
1184
1175
|
* The extra field of the entry.
|
|
1185
1176
|
*/
|
|
1186
1177
|
extraField?: Map<number, Uint8Array>;
|
|
1178
|
+
/**
|
|
1179
|
+
* The uncompressed size of the entry. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
|
|
1180
|
+
*/
|
|
1181
|
+
uncompressedSize?: number;
|
|
1182
|
+
/**
|
|
1183
|
+
* The signature (CRC32 checksum) of the content. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
|
|
1184
|
+
*/
|
|
1185
|
+
signature?: number;
|
|
1187
1186
|
}
|
|
1188
1187
|
|
|
1189
1188
|
/**
|
|
@@ -1314,7 +1313,15 @@ export interface ZipWriterConstructorOptions {
|
|
|
1314
1313
|
*/
|
|
1315
1314
|
versionMadeBy?: number;
|
|
1316
1315
|
/**
|
|
1317
|
-
* `true` to to
|
|
1316
|
+
* `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D - Language Encoding (EFS)), `false` to mark the names as compliant with the original IBM Code Page 437.
|
|
1317
|
+
*
|
|
1318
|
+
* Note that this does not ensure that the file names are in the correct encoding.
|
|
1319
|
+
*
|
|
1320
|
+
* @defaultValue true
|
|
1321
|
+
*/
|
|
1322
|
+
useUnicodeFileNames?: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* `true` to add a data descriptor.
|
|
1318
1325
|
*
|
|
1319
1326
|
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be set to `true`.
|
|
1320
1327
|
*
|
|
@@ -1357,6 +1364,18 @@ export interface ZipWriterConstructorOptions {
|
|
|
1357
1364
|
* @defaultValue false
|
|
1358
1365
|
*/
|
|
1359
1366
|
usdz?: boolean;
|
|
1367
|
+
/**
|
|
1368
|
+
* `true` to write the data as-is without compressing it and without crypting it.
|
|
1369
|
+
*/
|
|
1370
|
+
passThrough?: boolean;
|
|
1371
|
+
/**
|
|
1372
|
+
* `true` to write encrypted data when `passThrough` is set to `true`.
|
|
1373
|
+
*/
|
|
1374
|
+
encrypted?: boolean;
|
|
1375
|
+
/**
|
|
1376
|
+
* The offset of the first entry in the zip file.
|
|
1377
|
+
*/
|
|
1378
|
+
offset?: number;
|
|
1360
1379
|
/**
|
|
1361
1380
|
* Encode the filename and the comment of the entry.
|
|
1362
1381
|
*
|
|
@@ -2046,3 +2065,7 @@ export const ERR_SPLIT_ZIP_FILE: string;
|
|
|
2046
2065
|
* Iteration completed too soon error
|
|
2047
2066
|
*/
|
|
2048
2067
|
export const ERR_ITERATOR_COMPLETED_TOO_SOON: string;
|
|
2068
|
+
/**
|
|
2069
|
+
* Undefined uncompressed size error
|
|
2070
|
+
*/
|
|
2071
|
+
export const ERR_UNDEFINED_UNCOMPRESSED_SIZE: string
|