@zip.js/zip.js 2.8.11 → 2.8.14
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/README.md +19 -7
- package/deno.json +1 -1
- package/dist/zip-core.js +33 -26
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core.js +33 -26
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-native.js +33 -26
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +33 -26
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +33 -26
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +33 -26
- package/dist/zip-native.min.js +1 -1
- package/dist/zip.js +33 -26
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +33 -26
- package/index-native.min.js +1 -1
- package/index.cjs +33 -26
- package/index.d.ts +13 -2
- package/index.min.js +1 -1
- package/lib/core/zip-writer.js +33 -26
- package/package.json +4 -4
package/lib/core/zip-writer.js
CHANGED
|
@@ -1038,15 +1038,19 @@ function getHeaderInfo(options) {
|
|
|
1038
1038
|
let { version, compressionMethod } = options;
|
|
1039
1039
|
const compressed = !directory && (level > 0 || (level === UNDEFINED_VALUE && compressionMethod !== 0));
|
|
1040
1040
|
let rawExtraFieldZip64;
|
|
1041
|
+
let rawLocalExtraFieldZip64;
|
|
1041
1042
|
const uncompressedFile = passThrough || !compressed;
|
|
1042
1043
|
const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
|
|
1043
1044
|
if (zip64) {
|
|
1044
1045
|
let rawExtraFieldZip64Length = 4;
|
|
1046
|
+
let rawLocalExtraFieldZip64Length = 4;
|
|
1045
1047
|
if (zip64UncompressedSize) {
|
|
1046
1048
|
rawExtraFieldZip64Length += 8;
|
|
1049
|
+
rawLocalExtraFieldZip64Length += 8;
|
|
1047
1050
|
}
|
|
1048
1051
|
if (zip64CompressedSize) {
|
|
1049
1052
|
rawExtraFieldZip64Length += 8;
|
|
1053
|
+
rawLocalExtraFieldZip64Length += 8;
|
|
1050
1054
|
}
|
|
1051
1055
|
if (zip64Offset) {
|
|
1052
1056
|
rawExtraFieldZip64Length += 8;
|
|
@@ -1056,18 +1060,28 @@ function getHeaderInfo(options) {
|
|
|
1056
1060
|
}
|
|
1057
1061
|
rawExtraFieldZip64 = new Uint8Array(rawExtraFieldZip64Length);
|
|
1058
1062
|
const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64);
|
|
1063
|
+
rawLocalExtraFieldZip64 = new Uint8Array(rawLocalExtraFieldZip64Length);
|
|
1064
|
+
const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
|
|
1059
1065
|
setUint16(rawExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
|
|
1060
1066
|
setUint16(rawExtraFieldZip64View, 2, getLength(rawExtraFieldZip64) - 4);
|
|
1067
|
+
setUint16(rawLocalExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
|
|
1068
|
+
setUint16(rawLocalExtraFieldZip64View, 2, getLength(rawLocalExtraFieldZip64) - 4);
|
|
1061
1069
|
if (zip64ExtraFieldComplete) {
|
|
1062
1070
|
const rawExtraFieldZip64View = getDataView(rawExtraFieldZip64);
|
|
1071
|
+
const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
|
|
1063
1072
|
let rawExtraFieldZip64Offset = 4;
|
|
1073
|
+
let rawLocalExtraFieldZip64Offset = 4;
|
|
1064
1074
|
if (zip64UncompressedSize) {
|
|
1065
1075
|
setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(uncompressedSize));
|
|
1066
1076
|
rawExtraFieldZip64Offset += 8;
|
|
1077
|
+
setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
|
|
1078
|
+
rawLocalExtraFieldZip64Offset += 8;
|
|
1067
1079
|
}
|
|
1068
1080
|
if (zip64CompressedSize && uncompressedFile) {
|
|
1069
1081
|
setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(uncompressedSize));
|
|
1070
1082
|
rawExtraFieldZip64Offset += 8;
|
|
1083
|
+
setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
|
|
1084
|
+
rawLocalExtraFieldZip64Offset += 8;
|
|
1071
1085
|
}
|
|
1072
1086
|
if (zip64Offset) {
|
|
1073
1087
|
setBigUint64(rawExtraFieldZip64View, rawExtraFieldZip64Offset, BigInt(offset));
|
|
@@ -1077,9 +1091,13 @@ function getHeaderInfo(options) {
|
|
|
1077
1091
|
setUint32(rawExtraFieldZip64View, rawExtraFieldZip64Offset, diskNumberStart);
|
|
1078
1092
|
rawExtraFieldZip64Offset += 4;
|
|
1079
1093
|
}
|
|
1094
|
+
if (rawLocalExtraFieldZip64Offset == 4) {
|
|
1095
|
+
rawLocalExtraFieldZip64 = new Uint8Array();
|
|
1096
|
+
}
|
|
1080
1097
|
}
|
|
1081
1098
|
} else {
|
|
1082
1099
|
rawExtraFieldZip64 = new Uint8Array();
|
|
1100
|
+
rawLocalExtraFieldZip64 = new Uint8Array();
|
|
1083
1101
|
}
|
|
1084
1102
|
let rawExtraFieldAES;
|
|
1085
1103
|
if (encrypted && !zipCrypto) {
|
|
@@ -1182,7 +1200,7 @@ function getHeaderInfo(options) {
|
|
|
1182
1200
|
rawExtraFieldAES[9] = compressionMethod;
|
|
1183
1201
|
compressionMethod = COMPRESSION_METHOD_AES;
|
|
1184
1202
|
}
|
|
1185
|
-
const localExtraFieldZip64Length = zip64ExtraFieldComplete ? getLength(
|
|
1203
|
+
const localExtraFieldZip64Length = zip64ExtraFieldComplete ? getLength(rawLocalExtraFieldZip64) : 0;
|
|
1186
1204
|
const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
|
|
1187
1205
|
const {
|
|
1188
1206
|
headerArray,
|
|
@@ -1207,7 +1225,7 @@ function getHeaderInfo(options) {
|
|
|
1207
1225
|
arraySet(localHeaderArray, rawFilename, localHeaderOffset);
|
|
1208
1226
|
localHeaderOffset += getLength(rawFilename);
|
|
1209
1227
|
if (zip64ExtraFieldComplete) {
|
|
1210
|
-
arraySet(localHeaderArray,
|
|
1228
|
+
arraySet(localHeaderArray, rawLocalExtraFieldZip64, localHeaderOffset);
|
|
1211
1229
|
}
|
|
1212
1230
|
localHeaderOffset += localExtraFieldZip64Length;
|
|
1213
1231
|
arraySet(localHeaderArray, rawExtraFieldAES, localHeaderOffset);
|
|
@@ -1380,40 +1398,29 @@ function updateLocalHeader({
|
|
|
1380
1398
|
signature,
|
|
1381
1399
|
compressedSize,
|
|
1382
1400
|
uncompressedSize,
|
|
1383
|
-
offset,
|
|
1384
|
-
diskNumberStart,
|
|
1385
1401
|
zip64UncompressedSize,
|
|
1386
|
-
zip64CompressedSize
|
|
1387
|
-
zip64Offset,
|
|
1388
|
-
zip64DiskNumberStart
|
|
1402
|
+
zip64CompressedSize
|
|
1389
1403
|
}, localHeaderView, { dataDescriptor }) {
|
|
1390
1404
|
if (!dataDescriptor) {
|
|
1391
1405
|
if (!encrypted) {
|
|
1392
1406
|
setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + 4, signature);
|
|
1393
1407
|
}
|
|
1394
|
-
if (!
|
|
1408
|
+
if (!zip64CompressedSize) {
|
|
1395
1409
|
setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + 4, compressedSize);
|
|
1410
|
+
}
|
|
1411
|
+
if (!zip64UncompressedSize) {
|
|
1396
1412
|
setUint32(localHeaderView, HEADER_OFFSET_UNCOMPRESSED_SIZE + 4, uncompressedSize);
|
|
1397
1413
|
}
|
|
1398
1414
|
}
|
|
1399
|
-
if (zip64) {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
localHeaderOffset += 8;
|
|
1409
|
-
}
|
|
1410
|
-
if (zip64Offset) {
|
|
1411
|
-
setBigUint64(localHeaderView, localHeaderOffset, BigInt(offset));
|
|
1412
|
-
localHeaderOffset += 8;
|
|
1413
|
-
}
|
|
1414
|
-
if (zip64DiskNumberStart) {
|
|
1415
|
-
setUint32(localHeaderView, localHeaderOffset, diskNumberStart);
|
|
1416
|
-
}
|
|
1415
|
+
if (zip64 && localExtraFieldZip64Length) {
|
|
1416
|
+
let localHeaderOffset = HEADER_SIZE + getLength(rawFilename) + 4;
|
|
1417
|
+
if (zip64UncompressedSize) {
|
|
1418
|
+
setBigUint64(localHeaderView, localHeaderOffset, BigInt(uncompressedSize));
|
|
1419
|
+
localHeaderOffset += 8;
|
|
1420
|
+
}
|
|
1421
|
+
if (zip64CompressedSize) {
|
|
1422
|
+
setBigUint64(localHeaderView, localHeaderOffset, BigInt(compressedSize));
|
|
1423
|
+
localHeaderOffset += 8;
|
|
1417
1424
|
}
|
|
1418
1425
|
}
|
|
1419
1426
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
|
|
4
4
|
"author": "Gildas Lormeau",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
|
-
"version": "2.8.
|
|
6
|
+
"version": "2.8.14",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"zip",
|
|
@@ -156,10 +156,10 @@
|
|
|
156
156
|
"devDependencies": {
|
|
157
157
|
"@rollup/plugin-replace": "^6.0.3",
|
|
158
158
|
"@rollup/plugin-terser": "^0.4.4",
|
|
159
|
-
"eslint": "^9.39.
|
|
159
|
+
"eslint": "^9.39.2",
|
|
160
160
|
"http-server": "^14.1.1",
|
|
161
|
-
"rollup": "^4.
|
|
162
|
-
"typedoc": "^0.28.
|
|
161
|
+
"rollup": "^4.55.1",
|
|
162
|
+
"typedoc": "^0.28.15",
|
|
163
163
|
"typedoc-plugin-markdown": "^4.9.0"
|
|
164
164
|
}
|
|
165
165
|
}
|