@zip.js/zip.js 2.7.63 → 2.7.64
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 +396 -149
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +396 -149
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +393 -145
- 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 +393 -145
- package/dist/zip.min.js +1 -1
- package/index-fflate.js +2 -1
- package/index.cjs +396 -149
- package/index.d.ts +116 -77
- package/index.js +1 -0
- package/index.min.js +1 -1
- package/lib/core/constants.js +3 -0
- package/lib/core/io.js +1 -0
- package/lib/core/zip-fs-core.js +3 -4
- package/lib/core/zip-reader.js +5 -3
- package/lib/core/zip-writer.js +391 -143
- package/package.json +3 -3
package/lib/core/constants.js
CHANGED
|
@@ -69,6 +69,8 @@ const VERSION_AES = 0x33;
|
|
|
69
69
|
|
|
70
70
|
const DIRECTORY_SIGNATURE = "/";
|
|
71
71
|
|
|
72
|
+
const HEADER_SIZE = 26;
|
|
73
|
+
|
|
72
74
|
const MAX_DATE = new Date(2107, 11, 31);
|
|
73
75
|
const MIN_DATE = new Date(1980, 0, 1);
|
|
74
76
|
|
|
@@ -113,6 +115,7 @@ export {
|
|
|
113
115
|
VERSION_DEFLATE,
|
|
114
116
|
VERSION_ZIP64,
|
|
115
117
|
VERSION_AES,
|
|
118
|
+
HEADER_SIZE,
|
|
116
119
|
DIRECTORY_SIGNATURE,
|
|
117
120
|
MIN_DATE,
|
|
118
121
|
MAX_DATE,
|
package/lib/core/io.js
CHANGED
package/lib/core/zip-fs-core.js
CHANGED
|
@@ -772,9 +772,8 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
772
772
|
});
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
await zipWriter.add(name, child.reader, Object.assign({
|
|
776
|
-
directory: child.directory
|
|
777
|
-
}, Object.assign({}, options, zipEntryOptions, childOptions, {
|
|
775
|
+
await zipWriter.add(name, child.reader, Object.assign({}, options, zipEntryOptions, childOptions, {
|
|
776
|
+
directory: child.directory,
|
|
778
777
|
onprogress: async indexProgress => {
|
|
779
778
|
if (options.onprogress) {
|
|
780
779
|
entryOffsets.set(name, indexProgress);
|
|
@@ -786,7 +785,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
786
785
|
}
|
|
787
786
|
}
|
|
788
787
|
}
|
|
789
|
-
}))
|
|
788
|
+
}));
|
|
790
789
|
await process(zipWriter, child);
|
|
791
790
|
}
|
|
792
791
|
}
|
package/lib/core/zip-reader.js
CHANGED
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
FILE_ATTR_UNIX_TYPE_DIR,
|
|
62
62
|
FILE_ATTR_UNIX_EXECUTABLE_MASK,
|
|
63
63
|
DIRECTORY_SIGNATURE,
|
|
64
|
+
HEADER_SIZE,
|
|
64
65
|
UNDEFINED_VALUE
|
|
65
66
|
} from "./constants.js";
|
|
66
67
|
import {
|
|
@@ -416,7 +417,8 @@ class ZipEntry {
|
|
|
416
417
|
compressedSize
|
|
417
418
|
} = zipEntry;
|
|
418
419
|
const localDirectory = fileEntry.localDirectory = {};
|
|
419
|
-
const
|
|
420
|
+
const dataArraySize = HEADER_SIZE + 4;
|
|
421
|
+
const dataArray = await readUint8Array(reader, offset, dataArraySize + 4, diskNumberStart);
|
|
420
422
|
const dataView = getDataView(dataArray);
|
|
421
423
|
let password = getOptionValue(zipEntry, options, "password");
|
|
422
424
|
let rawPassword = getOptionValue(zipEntry, options, "rawPassword");
|
|
@@ -436,7 +438,7 @@ class ZipEntry {
|
|
|
436
438
|
}
|
|
437
439
|
readCommonHeader(localDirectory, dataView, 4);
|
|
438
440
|
localDirectory.rawExtraField = localDirectory.extraFieldLength ?
|
|
439
|
-
await readUint8Array(reader, offset +
|
|
441
|
+
await readUint8Array(reader, offset + dataArraySize + localDirectory.filenameLength, localDirectory.extraFieldLength, diskNumberStart) :
|
|
440
442
|
new Uint8Array();
|
|
441
443
|
readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
|
|
442
444
|
Object.assign(fileEntry, {
|
|
@@ -455,7 +457,7 @@ class ZipEntry {
|
|
|
455
457
|
throw new Error(ERR_ENCRYPTED);
|
|
456
458
|
}
|
|
457
459
|
}
|
|
458
|
-
const dataOffset = offset +
|
|
460
|
+
const dataOffset = offset + dataArraySize + localDirectory.filenameLength + localDirectory.extraFieldLength;
|
|
459
461
|
const size = compressedSize;
|
|
460
462
|
const readable = reader.readable;
|
|
461
463
|
Object.assign(readable, {
|