@zip.js/zip.js 2.7.22 → 2.7.23
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/dist/zip-fs-full.js +72 -186
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +60 -45
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +60 -45
- 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 +60 -45
- package/dist/zip.min.js +1 -1
- package/index.cjs +72 -186
- package/index.min.js +1 -1
- package/lib/core/util/mime-type.js +12 -141
- package/lib/core/zip-reader.js +18 -13
- package/lib/core/zip-writer.js +42 -32
- package/package.json +1 -1
|
@@ -38,10 +38,6 @@ const table = {
|
|
|
38
38
|
"atomcat+xml": "atomcat",
|
|
39
39
|
"atomserv+xml": "atomsrv",
|
|
40
40
|
"bbolin": "lin",
|
|
41
|
-
"cap": [
|
|
42
|
-
"cap",
|
|
43
|
-
"pcap"
|
|
44
|
-
],
|
|
45
41
|
"cu-seeme": "cu",
|
|
46
42
|
"davmount+xml": "davmount",
|
|
47
43
|
"dsptype": "tsp",
|
|
@@ -90,10 +86,6 @@ const table = {
|
|
|
90
86
|
"rdf+xml": "rdf",
|
|
91
87
|
"rss+xml": "rss",
|
|
92
88
|
"rtf": "rtf",
|
|
93
|
-
"smil": [
|
|
94
|
-
"smi",
|
|
95
|
-
"smil"
|
|
96
|
-
],
|
|
97
89
|
"xhtml+xml": [
|
|
98
90
|
"xhtml",
|
|
99
91
|
"xht"
|
|
@@ -218,10 +210,6 @@ const table = {
|
|
|
218
210
|
"x-chess-pgn": "pgn",
|
|
219
211
|
"x-cpio": "cpio",
|
|
220
212
|
"x-csh": "csh",
|
|
221
|
-
"x-debian-package": [
|
|
222
|
-
"deb",
|
|
223
|
-
"udeb"
|
|
224
|
-
],
|
|
225
213
|
"x-director": [
|
|
226
214
|
"dir",
|
|
227
215
|
"dxr",
|
|
@@ -267,46 +255,23 @@ const table = {
|
|
|
267
255
|
"x-java-jnlp-file": "jnlp",
|
|
268
256
|
"x-jmol": "jmz",
|
|
269
257
|
"x-killustrator": "kil",
|
|
270
|
-
"x-koan": [
|
|
271
|
-
"skp",
|
|
272
|
-
"skd",
|
|
273
|
-
"skt",
|
|
274
|
-
"skm"
|
|
275
|
-
],
|
|
276
|
-
"x-kpresenter": [
|
|
277
|
-
"kpr",
|
|
278
|
-
"kpt"
|
|
279
|
-
],
|
|
280
|
-
"x-kword": [
|
|
281
|
-
"kwd",
|
|
282
|
-
"kwt"
|
|
283
|
-
],
|
|
284
258
|
"x-latex": "latex",
|
|
285
|
-
"x-lha": "lha",
|
|
286
259
|
"x-lyx": "lyx",
|
|
287
|
-
"x-lzh": "lzh",
|
|
288
260
|
"x-lzx": "lzx",
|
|
289
261
|
"x-maker": [
|
|
290
262
|
"frm",
|
|
291
|
-
"maker",
|
|
292
|
-
"frame",
|
|
293
|
-
"fm",
|
|
294
263
|
"fb",
|
|
295
|
-
"book",
|
|
296
264
|
"fbdoc"
|
|
297
265
|
],
|
|
298
266
|
"x-ms-wmd": "wmd",
|
|
299
|
-
"x-ms-wmz": "wmz",
|
|
300
267
|
"x-msdos-program": [
|
|
301
268
|
"com",
|
|
302
269
|
"exe",
|
|
303
270
|
"bat",
|
|
304
271
|
"dll"
|
|
305
272
|
],
|
|
306
|
-
"x-msi": "msi",
|
|
307
273
|
"x-netcdf": [
|
|
308
|
-
"nc"
|
|
309
|
-
"cdf"
|
|
274
|
+
"nc"
|
|
310
275
|
],
|
|
311
276
|
"x-ns-proxy-autoconfig": [
|
|
312
277
|
"pac",
|
|
@@ -342,7 +307,6 @@ const table = {
|
|
|
342
307
|
"x-sv4cpio": "sv4cpio",
|
|
343
308
|
"x-sv4crc": "sv4crc",
|
|
344
309
|
"x-tar": "tar",
|
|
345
|
-
"x-tcl": "tcl",
|
|
346
310
|
"x-tex-gf": "gf",
|
|
347
311
|
"x-tex-pk": "pk",
|
|
348
312
|
"x-texinfo": [
|
|
@@ -356,14 +320,6 @@ const table = {
|
|
|
356
320
|
"old",
|
|
357
321
|
"sik"
|
|
358
322
|
],
|
|
359
|
-
"x-troff": [
|
|
360
|
-
"t",
|
|
361
|
-
"tr",
|
|
362
|
-
"roff"
|
|
363
|
-
],
|
|
364
|
-
"x-troff-man": "man",
|
|
365
|
-
"x-troff-me": "me",
|
|
366
|
-
"x-troff-ms": "ms",
|
|
367
323
|
"x-ustar": "ustar",
|
|
368
324
|
"x-wais-source": "src",
|
|
369
325
|
"x-wingz": "wz",
|
|
@@ -955,13 +911,7 @@ const table = {
|
|
|
955
911
|
"x-msbinder": "obd",
|
|
956
912
|
"x-mscardfile": "crd",
|
|
957
913
|
"x-msclip": "clp",
|
|
958
|
-
"x-
|
|
959
|
-
"exe",
|
|
960
|
-
"dll",
|
|
961
|
-
"com",
|
|
962
|
-
"bat",
|
|
963
|
-
"msi"
|
|
964
|
-
],
|
|
914
|
+
"application/x-ms-installer": "msi",
|
|
965
915
|
"x-msmediaview": [
|
|
966
916
|
"mvb",
|
|
967
917
|
"m13",
|
|
@@ -993,8 +943,6 @@ const table = {
|
|
|
993
943
|
"x-stuffitx": "sitx",
|
|
994
944
|
"x-subrip": "srt",
|
|
995
945
|
"x-t3vm-image": "t3",
|
|
996
|
-
"x-tads": "gam",
|
|
997
|
-
"x-tex": "tex",
|
|
998
946
|
"x-tex-tfm": "tfm",
|
|
999
947
|
"x-tgif": "obj",
|
|
1000
948
|
"x-xliff+xml": "xlf",
|
|
@@ -1031,22 +979,12 @@ const table = {
|
|
|
1031
979
|
"vnd.ms-outlook": "msg",
|
|
1032
980
|
"vnd.ms-pkicertstore": "sst",
|
|
1033
981
|
"x-compress": "z",
|
|
1034
|
-
"x-compressed": "tgz",
|
|
1035
|
-
"x-gzip": [
|
|
1036
|
-
"gz",
|
|
1037
|
-
"tgz"
|
|
1038
|
-
],
|
|
1039
982
|
"x-perfmon": [
|
|
1040
983
|
"pma",
|
|
1041
984
|
"pmc",
|
|
1042
|
-
"pml",
|
|
1043
985
|
"pmr",
|
|
1044
986
|
"pmw"
|
|
1045
987
|
],
|
|
1046
|
-
"x-pkcs7-mime": [
|
|
1047
|
-
"p7c",
|
|
1048
|
-
"p7m"
|
|
1049
|
-
],
|
|
1050
988
|
"ynd.ms-pkipko": "pko",
|
|
1051
989
|
"gzip": [
|
|
1052
990
|
"gz",
|
|
@@ -1080,15 +1018,6 @@ const table = {
|
|
|
1080
1018
|
"pm",
|
|
1081
1019
|
"pl"
|
|
1082
1020
|
],
|
|
1083
|
-
"x-sqlite3": [
|
|
1084
|
-
"db",
|
|
1085
|
-
"sqlite",
|
|
1086
|
-
"sqlite3",
|
|
1087
|
-
"db-wal",
|
|
1088
|
-
"sqlite-wal",
|
|
1089
|
-
"db-shm",
|
|
1090
|
-
"sqlite-shm"
|
|
1091
|
-
],
|
|
1092
1021
|
"yaml": [
|
|
1093
1022
|
"yaml",
|
|
1094
1023
|
"yml"
|
|
@@ -1112,7 +1041,6 @@ const table = {
|
|
|
1112
1041
|
"mpeg": [
|
|
1113
1042
|
"mpga",
|
|
1114
1043
|
"mpega",
|
|
1115
|
-
"mp2",
|
|
1116
1044
|
"mp3",
|
|
1117
1045
|
"m4a",
|
|
1118
1046
|
"mp2a",
|
|
@@ -1126,11 +1054,7 @@ const table = {
|
|
|
1126
1054
|
"spx"
|
|
1127
1055
|
],
|
|
1128
1056
|
"prs.sid": "sid",
|
|
1129
|
-
"x-aiff":
|
|
1130
|
-
"aif",
|
|
1131
|
-
"aiff",
|
|
1132
|
-
"aifc"
|
|
1133
|
-
],
|
|
1057
|
+
"x-aiff": "aifc",
|
|
1134
1058
|
"x-gsm": "gsm",
|
|
1135
1059
|
"x-ms-wma": "wma",
|
|
1136
1060
|
"x-ms-wax": "wax",
|
|
@@ -1156,20 +1080,11 @@ const table = {
|
|
|
1156
1080
|
"vnd.nuera.ecelp9600": "ecelp9600",
|
|
1157
1081
|
"vnd.rip": "rip",
|
|
1158
1082
|
"webm": "weba",
|
|
1159
|
-
"x-aac": "aac",
|
|
1160
1083
|
"x-caf": "caf",
|
|
1161
1084
|
"x-matroska": "mka",
|
|
1162
1085
|
"x-pn-realaudio-plugin": "rmp",
|
|
1163
1086
|
"xm": "xm",
|
|
1164
|
-
"
|
|
1165
|
-
"mid",
|
|
1166
|
-
"rmi"
|
|
1167
|
-
],
|
|
1168
|
-
"aac": [
|
|
1169
|
-
"aac",
|
|
1170
|
-
"mp4",
|
|
1171
|
-
"m4a"
|
|
1172
|
-
],
|
|
1087
|
+
"aac": "aac",
|
|
1173
1088
|
"aiff": [
|
|
1174
1089
|
"aiff",
|
|
1175
1090
|
"aif",
|
|
@@ -1239,17 +1154,11 @@ const table = {
|
|
|
1239
1154
|
],
|
|
1240
1155
|
"x-kinemage": "kin",
|
|
1241
1156
|
"x-macmolecule": "mcm",
|
|
1242
|
-
"x-macromodel-input":
|
|
1243
|
-
"mmd",
|
|
1244
|
-
"mmod"
|
|
1245
|
-
],
|
|
1157
|
+
"x-macromodel-input": "mmod",
|
|
1246
1158
|
"x-mdl-molfile": "mol",
|
|
1247
1159
|
"x-mdl-rdfile": "rd",
|
|
1248
1160
|
"x-mdl-rxnfile": "rxn",
|
|
1249
|
-
"x-mdl-sdfile":
|
|
1250
|
-
"sd",
|
|
1251
|
-
"sdf"
|
|
1252
|
-
],
|
|
1161
|
+
"x-mdl-sdfile": "sd",
|
|
1253
1162
|
"x-mdl-tgf": "tgf",
|
|
1254
1163
|
"x-mmcif": "mcif",
|
|
1255
1164
|
"x-mol2": "mol2",
|
|
@@ -1258,7 +1167,6 @@ const table = {
|
|
|
1258
1167
|
"x-mopac-input": [
|
|
1259
1168
|
"mop",
|
|
1260
1169
|
"mopcrt",
|
|
1261
|
-
"mpc",
|
|
1262
1170
|
"zmt"
|
|
1263
1171
|
],
|
|
1264
1172
|
"x-mopac-out": "moo",
|
|
@@ -1267,14 +1175,7 @@ const table = {
|
|
|
1267
1175
|
"prt",
|
|
1268
1176
|
"ent"
|
|
1269
1177
|
],
|
|
1270
|
-
"x-ncbi-asn1-binary":
|
|
1271
|
-
"val",
|
|
1272
|
-
"aso"
|
|
1273
|
-
],
|
|
1274
|
-
"x-pdb": [
|
|
1275
|
-
"pdb",
|
|
1276
|
-
"ent"
|
|
1277
|
-
],
|
|
1178
|
+
"x-ncbi-asn1-binary": "val",
|
|
1278
1179
|
"x-rosdal": "ros",
|
|
1279
1180
|
"x-swissprot": "sw",
|
|
1280
1181
|
"x-vamas-iso14976": "vms",
|
|
@@ -1294,7 +1195,6 @@ const table = {
|
|
|
1294
1195
|
"jpeg",
|
|
1295
1196
|
"jpg",
|
|
1296
1197
|
"jpe",
|
|
1297
|
-
"pjpg",
|
|
1298
1198
|
"jfif",
|
|
1299
1199
|
"jfif-tbnl",
|
|
1300
1200
|
"jif"
|
|
@@ -1380,13 +1280,7 @@ const table = {
|
|
|
1380
1280
|
"heic"
|
|
1381
1281
|
],
|
|
1382
1282
|
"pjpeg": [
|
|
1383
|
-
"
|
|
1384
|
-
"jpeg",
|
|
1385
|
-
"jpg",
|
|
1386
|
-
"pjpg",
|
|
1387
|
-
"jfi",
|
|
1388
|
-
"jfif-tbnl",
|
|
1389
|
-
"jif"
|
|
1283
|
+
"pjpg"
|
|
1390
1284
|
],
|
|
1391
1285
|
"vnd.adobe.photoshop": "psd",
|
|
1392
1286
|
"x-adobe-dng": "dng",
|
|
@@ -1437,10 +1331,7 @@ const table = {
|
|
|
1437
1331
|
"x3dv",
|
|
1438
1332
|
"x3dvz"
|
|
1439
1333
|
],
|
|
1440
|
-
"x3d+xml":
|
|
1441
|
-
"x3d",
|
|
1442
|
-
"x3dz"
|
|
1443
|
-
],
|
|
1334
|
+
"x3d+xml": "x3dz",
|
|
1444
1335
|
"x3d+binary": [
|
|
1445
1336
|
"x3db",
|
|
1446
1337
|
"x3dbz"
|
|
@@ -1483,8 +1374,7 @@ const table = {
|
|
|
1483
1374
|
"in",
|
|
1484
1375
|
"bas",
|
|
1485
1376
|
"diff",
|
|
1486
|
-
"ksh"
|
|
1487
|
-
"pl"
|
|
1377
|
+
"ksh"
|
|
1488
1378
|
],
|
|
1489
1379
|
"richtext": "rtx",
|
|
1490
1380
|
"scriptlet": [
|
|
@@ -1512,10 +1402,7 @@ const table = {
|
|
|
1512
1402
|
],
|
|
1513
1403
|
"x-component": "htc",
|
|
1514
1404
|
"x-dsrc": "d",
|
|
1515
|
-
"x-diff":
|
|
1516
|
-
"diff",
|
|
1517
|
-
"patch"
|
|
1518
|
-
],
|
|
1405
|
+
"x-diff": "patch",
|
|
1519
1406
|
"x-haskell": "hs",
|
|
1520
1407
|
"x-java": "java",
|
|
1521
1408
|
"x-literate-haskell": "lhs",
|
|
@@ -1527,10 +1414,6 @@ const table = {
|
|
|
1527
1414
|
"inc"
|
|
1528
1415
|
],
|
|
1529
1416
|
"x-pcs-gcd": "gcd",
|
|
1530
|
-
"x-perl": [
|
|
1531
|
-
"pl",
|
|
1532
|
-
"pm"
|
|
1533
|
-
],
|
|
1534
1417
|
"x-python": "py",
|
|
1535
1418
|
"x-scala": "scala",
|
|
1536
1419
|
"x-setext": "etx",
|
|
@@ -1583,11 +1466,7 @@ const table = {
|
|
|
1583
1466
|
],
|
|
1584
1467
|
"x-c": [
|
|
1585
1468
|
"c",
|
|
1586
|
-
"cc",
|
|
1587
|
-
"cxx",
|
|
1588
|
-
"cpp",
|
|
1589
1469
|
"h",
|
|
1590
|
-
"hh",
|
|
1591
1470
|
"dic"
|
|
1592
1471
|
],
|
|
1593
1472
|
"x-fortran": [
|
|
@@ -1610,13 +1489,7 @@ const table = {
|
|
|
1610
1489
|
"markdn"
|
|
1611
1490
|
],
|
|
1612
1491
|
"vnd.wap.si": "si",
|
|
1613
|
-
"vnd.wap.sl": "sl"
|
|
1614
|
-
"x-markdown": [
|
|
1615
|
-
"md",
|
|
1616
|
-
"markdown",
|
|
1617
|
-
"mdown",
|
|
1618
|
-
"markdn"
|
|
1619
|
-
]
|
|
1492
|
+
"vnd.wap.sl": "sl"
|
|
1620
1493
|
},
|
|
1621
1494
|
"video": {
|
|
1622
1495
|
"avif": "avif",
|
|
@@ -1730,8 +1603,6 @@ const table = {
|
|
|
1730
1603
|
"x-world": {
|
|
1731
1604
|
"x-vrml": [
|
|
1732
1605
|
"vrm",
|
|
1733
|
-
"vrml",
|
|
1734
|
-
"wrl",
|
|
1735
1606
|
"flr",
|
|
1736
1607
|
"wrz",
|
|
1737
1608
|
"xaf",
|
package/lib/core/zip-reader.js
CHANGED
|
@@ -383,7 +383,7 @@ class ZipEntry {
|
|
|
383
383
|
localDirectory.rawExtraField = localDirectory.extraFieldLength ?
|
|
384
384
|
await readUint8Array(reader, offset + 30 + localDirectory.filenameLength, localDirectory.extraFieldLength, diskNumberStart) :
|
|
385
385
|
new Uint8Array();
|
|
386
|
-
await readCommonFooter(zipEntry, localDirectory, dataView, 4);
|
|
386
|
+
await readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
|
|
387
387
|
Object.assign(fileEntry, {
|
|
388
388
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
389
389
|
creationDate: localDirectory.creationDate
|
|
@@ -470,7 +470,7 @@ function readCommonHeader(directory, dataView, offset) {
|
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
async function readCommonFooter(fileEntry, directory, dataView, offset) {
|
|
473
|
+
async function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) {
|
|
474
474
|
const { rawExtraField } = directory;
|
|
475
475
|
const extraField = directory.extraField = new Map();
|
|
476
476
|
const rawExtraFieldView = getDataView(new Uint8Array(rawExtraField));
|
|
@@ -523,7 +523,7 @@ async function readCommonFooter(fileEntry, directory, dataView, offset) {
|
|
|
523
523
|
}
|
|
524
524
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
525
525
|
if (extraFieldExtendedTimestamp) {
|
|
526
|
-
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory);
|
|
526
|
+
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
527
527
|
directory.extraFieldExtendedTimestamp = extraFieldExtendedTimestamp;
|
|
528
528
|
}
|
|
529
529
|
}
|
|
@@ -614,23 +614,28 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
616
|
|
|
617
|
-
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory) {
|
|
617
|
+
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory) {
|
|
618
618
|
const extraFieldView = getDataView(extraFieldExtendedTimestamp.data);
|
|
619
619
|
const flags = getUint8(extraFieldView, 0);
|
|
620
620
|
const timeProperties = [];
|
|
621
621
|
const timeRawProperties = [];
|
|
622
|
-
if (
|
|
622
|
+
if (localDirectory) {
|
|
623
|
+
if ((flags & 0x1) == 0x1) {
|
|
624
|
+
timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
|
|
625
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
|
|
626
|
+
}
|
|
627
|
+
if ((flags & 0x2) == 0x2) {
|
|
628
|
+
timeProperties.push(PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
629
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_ACCESS_DATE);
|
|
630
|
+
}
|
|
631
|
+
if ((flags & 0x4) == 0x4) {
|
|
632
|
+
timeProperties.push(PROPERTY_NAME_CREATION_DATE);
|
|
633
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_CREATION_DATE);
|
|
634
|
+
}
|
|
635
|
+
} else if (extraFieldExtendedTimestamp.data.length >= 5) {
|
|
623
636
|
timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
|
|
624
637
|
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
|
|
625
638
|
}
|
|
626
|
-
if ((flags & 0x2) == 0x2) {
|
|
627
|
-
timeProperties.push(PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
628
|
-
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_ACCESS_DATE);
|
|
629
|
-
}
|
|
630
|
-
if ((flags & 0x4) == 0x4) {
|
|
631
|
-
timeProperties.push(PROPERTY_NAME_CREATION_DATE);
|
|
632
|
-
timeRawProperties.push(PROPERTY_NAME_RAW_CREATION_DATE);
|
|
633
|
-
}
|
|
634
639
|
let offset = 1;
|
|
635
640
|
timeProperties.forEach((propertyName, indexProperty) => {
|
|
636
641
|
if (extraFieldExtendedTimestamp.data.length >= offset + 4) {
|
package/lib/core/zip-writer.js
CHANGED
|
@@ -482,6 +482,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
482
482
|
version,
|
|
483
483
|
compressionMethod,
|
|
484
484
|
rawExtraFieldExtendedTimestamp,
|
|
485
|
+
extraFieldExtendedTimestampFlag,
|
|
485
486
|
rawExtraFieldNTFS,
|
|
486
487
|
rawExtraFieldAES
|
|
487
488
|
} = headerInfo;
|
|
@@ -613,6 +614,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
613
614
|
headerArray,
|
|
614
615
|
signature,
|
|
615
616
|
rawExtraFieldZip64,
|
|
617
|
+
extraFieldExtendedTimestampFlag,
|
|
616
618
|
zip64UncompressedSize,
|
|
617
619
|
zip64CompressedSize,
|
|
618
620
|
zip64Offset,
|
|
@@ -635,7 +637,7 @@ function getHeaderInfo(options) {
|
|
|
635
637
|
directory,
|
|
636
638
|
rawExtraField,
|
|
637
639
|
encryptionStrength,
|
|
638
|
-
extendedTimestamp
|
|
640
|
+
extendedTimestamp
|
|
639
641
|
} = options;
|
|
640
642
|
const compressed = level !== 0 && !directory;
|
|
641
643
|
const encrypted = Boolean(password && getLength(password));
|
|
@@ -652,19 +654,23 @@ function getHeaderInfo(options) {
|
|
|
652
654
|
}
|
|
653
655
|
let rawExtraFieldNTFS;
|
|
654
656
|
let rawExtraFieldExtendedTimestamp;
|
|
657
|
+
let extraFieldExtendedTimestampFlag;
|
|
655
658
|
if (extendedTimestamp) {
|
|
656
659
|
rawExtraFieldExtendedTimestamp = new Uint8Array(9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0));
|
|
657
660
|
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
|
|
658
661
|
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
659
662
|
setUint16(extraFieldExtendedTimestampView, 2, getLength(rawExtraFieldExtendedTimestamp) - 4);
|
|
660
|
-
|
|
663
|
+
extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
|
|
661
664
|
setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
|
|
662
|
-
|
|
665
|
+
let offset = 5;
|
|
666
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastModDate.getTime() / 1000));
|
|
667
|
+
offset += 4;
|
|
663
668
|
if (lastAccessDate) {
|
|
664
|
-
setUint32(extraFieldExtendedTimestampView,
|
|
669
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastAccessDate.getTime() / 1000));
|
|
670
|
+
offset += 4;
|
|
665
671
|
}
|
|
666
672
|
if (creationDate) {
|
|
667
|
-
setUint32(extraFieldExtendedTimestampView,
|
|
673
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(creationDate.getTime() / 1000));
|
|
668
674
|
}
|
|
669
675
|
try {
|
|
670
676
|
rawExtraFieldNTFS = new Uint8Array(36);
|
|
@@ -745,6 +751,7 @@ function getHeaderInfo(options) {
|
|
|
745
751
|
compressed,
|
|
746
752
|
version,
|
|
747
753
|
compressionMethod,
|
|
754
|
+
extraFieldExtendedTimestampFlag,
|
|
748
755
|
rawExtraFieldExtendedTimestamp,
|
|
749
756
|
rawExtraFieldNTFS,
|
|
750
757
|
rawExtraFieldAES
|
|
@@ -881,23 +888,38 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
881
888
|
let directoryDataLength = 0;
|
|
882
889
|
let directoryOffset = zipWriter.offset - diskOffset;
|
|
883
890
|
let filesLength = files.size;
|
|
884
|
-
for (const [, {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
for (const [, fileEntry] of files) {
|
|
892
|
+
const {
|
|
893
|
+
rawFilename,
|
|
894
|
+
rawExtraFieldZip64,
|
|
895
|
+
rawExtraFieldAES,
|
|
896
|
+
rawComment,
|
|
897
|
+
rawExtraFieldNTFS,
|
|
898
|
+
rawExtraField,
|
|
899
|
+
extendedTimestamp,
|
|
900
|
+
extraFieldExtendedTimestampFlag,
|
|
901
|
+
lastModDate
|
|
902
|
+
} = fileEntry;
|
|
903
|
+
let rawExtraFieldTimestamp;
|
|
904
|
+
if (extendedTimestamp) {
|
|
905
|
+
rawExtraFieldTimestamp = new Uint8Array(9);
|
|
906
|
+
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldTimestamp);
|
|
907
|
+
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
908
|
+
setUint16(extraFieldExtendedTimestampView, 2, 5);
|
|
909
|
+
setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
|
|
910
|
+
setUint32(extraFieldExtendedTimestampView, 5, Math.floor(lastModDate.getTime() / 1000));
|
|
911
|
+
} else {
|
|
912
|
+
rawExtraFieldTimestamp = new Uint8Array();
|
|
913
|
+
}
|
|
914
|
+
fileEntry.rawExtraFieldCDExtendedTimestamp = rawExtraFieldTimestamp;
|
|
893
915
|
directoryDataLength += 46 +
|
|
894
916
|
getLength(
|
|
895
917
|
rawFilename,
|
|
896
918
|
rawComment,
|
|
897
919
|
rawExtraFieldZip64,
|
|
898
920
|
rawExtraFieldAES,
|
|
899
|
-
rawExtraFieldExtendedTimestamp,
|
|
900
921
|
rawExtraFieldNTFS,
|
|
922
|
+
rawExtraFieldTimestamp,
|
|
901
923
|
rawExtraField);
|
|
902
924
|
}
|
|
903
925
|
const directoryArray = new Uint8Array(directoryDataLength);
|
|
@@ -910,6 +932,7 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
910
932
|
rawFilename,
|
|
911
933
|
rawExtraFieldZip64,
|
|
912
934
|
rawExtraFieldAES,
|
|
935
|
+
rawExtraFieldCDExtendedTimestamp,
|
|
913
936
|
rawExtraFieldNTFS,
|
|
914
937
|
rawExtraField,
|
|
915
938
|
rawComment,
|
|
@@ -924,24 +947,11 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
924
947
|
msDosCompatible,
|
|
925
948
|
internalFileAttribute,
|
|
926
949
|
externalFileAttribute,
|
|
927
|
-
extendedTimestamp,
|
|
928
|
-
lastModDate,
|
|
929
950
|
diskNumberStart,
|
|
930
951
|
uncompressedSize,
|
|
931
952
|
compressedSize
|
|
932
953
|
} = fileEntry;
|
|
933
|
-
|
|
934
|
-
if (extendedTimestamp) {
|
|
935
|
-
rawExtraFieldExtendedTimestamp = new Uint8Array(9);
|
|
936
|
-
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
|
|
937
|
-
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
938
|
-
setUint16(extraFieldExtendedTimestampView, 2, getLength(rawExtraFieldExtendedTimestamp) - 4);
|
|
939
|
-
setUint8(extraFieldExtendedTimestampView, 4, 0x1);
|
|
940
|
-
setUint32(extraFieldExtendedTimestampView, 5, Math.floor(lastModDate.getTime() / 1000));
|
|
941
|
-
} else {
|
|
942
|
-
rawExtraFieldExtendedTimestamp = new Uint8Array();
|
|
943
|
-
}
|
|
944
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraField);
|
|
954
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp, rawExtraFieldNTFS, rawExtraField);
|
|
945
955
|
setUint32(directoryView, offset, CENTRAL_FILE_HEADER_SIGNATURE);
|
|
946
956
|
setUint16(directoryView, offset + 4, versionMadeBy);
|
|
947
957
|
const headerView = getDataView(headerArray);
|
|
@@ -965,9 +975,9 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
965
975
|
arraySet(directoryArray, rawFilename, offset + 46);
|
|
966
976
|
arraySet(directoryArray, rawExtraFieldZip64, offset + 46 + getLength(rawFilename));
|
|
967
977
|
arraySet(directoryArray, rawExtraFieldAES, offset + 46 + getLength(rawFilename, rawExtraFieldZip64));
|
|
968
|
-
arraySet(directoryArray,
|
|
969
|
-
arraySet(directoryArray, rawExtraFieldNTFS, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES,
|
|
970
|
-
arraySet(directoryArray, rawExtraField, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES,
|
|
978
|
+
arraySet(directoryArray, rawExtraFieldCDExtendedTimestamp, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES));
|
|
979
|
+
arraySet(directoryArray, rawExtraFieldNTFS, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp));
|
|
980
|
+
arraySet(directoryArray, rawExtraField, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp, rawExtraFieldNTFS));
|
|
971
981
|
arraySet(directoryArray, rawComment, offset + 46 + getLength(rawFilename) + extraFieldLength);
|
|
972
982
|
const directoryEntryLength = 46 + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
973
983
|
if (offset - directoryDiskOffset > writer.availableSize) {
|
package/package.json
CHANGED