@zip.js/zip.js 2.7.22 → 2.7.24
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 +88 -199
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +76 -58
- 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 +88 -199
- package/index.d.ts +1 -1
- package/index.min.js +1 -1
- package/lib/core/util/mime-type.js +12 -141
- package/lib/core/zip-fs-core.js +16 -13
- package/lib/core/zip-reader.js +18 -13
- package/lib/core/zip-writer.js +42 -32
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -4530,10 +4530,6 @@ const table$1 = {
|
|
|
4530
4530
|
"atomcat+xml": "atomcat",
|
|
4531
4531
|
"atomserv+xml": "atomsrv",
|
|
4532
4532
|
"bbolin": "lin",
|
|
4533
|
-
"cap": [
|
|
4534
|
-
"cap",
|
|
4535
|
-
"pcap"
|
|
4536
|
-
],
|
|
4537
4533
|
"cu-seeme": "cu",
|
|
4538
4534
|
"davmount+xml": "davmount",
|
|
4539
4535
|
"dsptype": "tsp",
|
|
@@ -4582,10 +4578,6 @@ const table$1 = {
|
|
|
4582
4578
|
"rdf+xml": "rdf",
|
|
4583
4579
|
"rss+xml": "rss",
|
|
4584
4580
|
"rtf": "rtf",
|
|
4585
|
-
"smil": [
|
|
4586
|
-
"smi",
|
|
4587
|
-
"smil"
|
|
4588
|
-
],
|
|
4589
4581
|
"xhtml+xml": [
|
|
4590
4582
|
"xhtml",
|
|
4591
4583
|
"xht"
|
|
@@ -4710,10 +4702,6 @@ const table$1 = {
|
|
|
4710
4702
|
"x-chess-pgn": "pgn",
|
|
4711
4703
|
"x-cpio": "cpio",
|
|
4712
4704
|
"x-csh": "csh",
|
|
4713
|
-
"x-debian-package": [
|
|
4714
|
-
"deb",
|
|
4715
|
-
"udeb"
|
|
4716
|
-
],
|
|
4717
4705
|
"x-director": [
|
|
4718
4706
|
"dir",
|
|
4719
4707
|
"dxr",
|
|
@@ -4759,46 +4747,23 @@ const table$1 = {
|
|
|
4759
4747
|
"x-java-jnlp-file": "jnlp",
|
|
4760
4748
|
"x-jmol": "jmz",
|
|
4761
4749
|
"x-killustrator": "kil",
|
|
4762
|
-
"x-koan": [
|
|
4763
|
-
"skp",
|
|
4764
|
-
"skd",
|
|
4765
|
-
"skt",
|
|
4766
|
-
"skm"
|
|
4767
|
-
],
|
|
4768
|
-
"x-kpresenter": [
|
|
4769
|
-
"kpr",
|
|
4770
|
-
"kpt"
|
|
4771
|
-
],
|
|
4772
|
-
"x-kword": [
|
|
4773
|
-
"kwd",
|
|
4774
|
-
"kwt"
|
|
4775
|
-
],
|
|
4776
4750
|
"x-latex": "latex",
|
|
4777
|
-
"x-lha": "lha",
|
|
4778
4751
|
"x-lyx": "lyx",
|
|
4779
|
-
"x-lzh": "lzh",
|
|
4780
4752
|
"x-lzx": "lzx",
|
|
4781
4753
|
"x-maker": [
|
|
4782
4754
|
"frm",
|
|
4783
|
-
"maker",
|
|
4784
|
-
"frame",
|
|
4785
|
-
"fm",
|
|
4786
4755
|
"fb",
|
|
4787
|
-
"book",
|
|
4788
4756
|
"fbdoc"
|
|
4789
4757
|
],
|
|
4790
4758
|
"x-ms-wmd": "wmd",
|
|
4791
|
-
"x-ms-wmz": "wmz",
|
|
4792
4759
|
"x-msdos-program": [
|
|
4793
4760
|
"com",
|
|
4794
4761
|
"exe",
|
|
4795
4762
|
"bat",
|
|
4796
4763
|
"dll"
|
|
4797
4764
|
],
|
|
4798
|
-
"x-msi": "msi",
|
|
4799
4765
|
"x-netcdf": [
|
|
4800
|
-
"nc"
|
|
4801
|
-
"cdf"
|
|
4766
|
+
"nc"
|
|
4802
4767
|
],
|
|
4803
4768
|
"x-ns-proxy-autoconfig": [
|
|
4804
4769
|
"pac",
|
|
@@ -4834,7 +4799,6 @@ const table$1 = {
|
|
|
4834
4799
|
"x-sv4cpio": "sv4cpio",
|
|
4835
4800
|
"x-sv4crc": "sv4crc",
|
|
4836
4801
|
"x-tar": "tar",
|
|
4837
|
-
"x-tcl": "tcl",
|
|
4838
4802
|
"x-tex-gf": "gf",
|
|
4839
4803
|
"x-tex-pk": "pk",
|
|
4840
4804
|
"x-texinfo": [
|
|
@@ -4848,14 +4812,6 @@ const table$1 = {
|
|
|
4848
4812
|
"old",
|
|
4849
4813
|
"sik"
|
|
4850
4814
|
],
|
|
4851
|
-
"x-troff": [
|
|
4852
|
-
"t",
|
|
4853
|
-
"tr",
|
|
4854
|
-
"roff"
|
|
4855
|
-
],
|
|
4856
|
-
"x-troff-man": "man",
|
|
4857
|
-
"x-troff-me": "me",
|
|
4858
|
-
"x-troff-ms": "ms",
|
|
4859
4815
|
"x-ustar": "ustar",
|
|
4860
4816
|
"x-wais-source": "src",
|
|
4861
4817
|
"x-wingz": "wz",
|
|
@@ -5447,13 +5403,7 @@ const table$1 = {
|
|
|
5447
5403
|
"x-msbinder": "obd",
|
|
5448
5404
|
"x-mscardfile": "crd",
|
|
5449
5405
|
"x-msclip": "clp",
|
|
5450
|
-
"x-
|
|
5451
|
-
"exe",
|
|
5452
|
-
"dll",
|
|
5453
|
-
"com",
|
|
5454
|
-
"bat",
|
|
5455
|
-
"msi"
|
|
5456
|
-
],
|
|
5406
|
+
"application/x-ms-installer": "msi",
|
|
5457
5407
|
"x-msmediaview": [
|
|
5458
5408
|
"mvb",
|
|
5459
5409
|
"m13",
|
|
@@ -5485,8 +5435,6 @@ const table$1 = {
|
|
|
5485
5435
|
"x-stuffitx": "sitx",
|
|
5486
5436
|
"x-subrip": "srt",
|
|
5487
5437
|
"x-t3vm-image": "t3",
|
|
5488
|
-
"x-tads": "gam",
|
|
5489
|
-
"x-tex": "tex",
|
|
5490
5438
|
"x-tex-tfm": "tfm",
|
|
5491
5439
|
"x-tgif": "obj",
|
|
5492
5440
|
"x-xliff+xml": "xlf",
|
|
@@ -5523,22 +5471,12 @@ const table$1 = {
|
|
|
5523
5471
|
"vnd.ms-outlook": "msg",
|
|
5524
5472
|
"vnd.ms-pkicertstore": "sst",
|
|
5525
5473
|
"x-compress": "z",
|
|
5526
|
-
"x-compressed": "tgz",
|
|
5527
|
-
"x-gzip": [
|
|
5528
|
-
"gz",
|
|
5529
|
-
"tgz"
|
|
5530
|
-
],
|
|
5531
5474
|
"x-perfmon": [
|
|
5532
5475
|
"pma",
|
|
5533
5476
|
"pmc",
|
|
5534
|
-
"pml",
|
|
5535
5477
|
"pmr",
|
|
5536
5478
|
"pmw"
|
|
5537
5479
|
],
|
|
5538
|
-
"x-pkcs7-mime": [
|
|
5539
|
-
"p7c",
|
|
5540
|
-
"p7m"
|
|
5541
|
-
],
|
|
5542
5480
|
"ynd.ms-pkipko": "pko",
|
|
5543
5481
|
"gzip": [
|
|
5544
5482
|
"gz",
|
|
@@ -5572,15 +5510,6 @@ const table$1 = {
|
|
|
5572
5510
|
"pm",
|
|
5573
5511
|
"pl"
|
|
5574
5512
|
],
|
|
5575
|
-
"x-sqlite3": [
|
|
5576
|
-
"db",
|
|
5577
|
-
"sqlite",
|
|
5578
|
-
"sqlite3",
|
|
5579
|
-
"db-wal",
|
|
5580
|
-
"sqlite-wal",
|
|
5581
|
-
"db-shm",
|
|
5582
|
-
"sqlite-shm"
|
|
5583
|
-
],
|
|
5584
5513
|
"yaml": [
|
|
5585
5514
|
"yaml",
|
|
5586
5515
|
"yml"
|
|
@@ -5604,7 +5533,6 @@ const table$1 = {
|
|
|
5604
5533
|
"mpeg": [
|
|
5605
5534
|
"mpga",
|
|
5606
5535
|
"mpega",
|
|
5607
|
-
"mp2",
|
|
5608
5536
|
"mp3",
|
|
5609
5537
|
"m4a",
|
|
5610
5538
|
"mp2a",
|
|
@@ -5618,11 +5546,7 @@ const table$1 = {
|
|
|
5618
5546
|
"spx"
|
|
5619
5547
|
],
|
|
5620
5548
|
"prs.sid": "sid",
|
|
5621
|
-
"x-aiff":
|
|
5622
|
-
"aif",
|
|
5623
|
-
"aiff",
|
|
5624
|
-
"aifc"
|
|
5625
|
-
],
|
|
5549
|
+
"x-aiff": "aifc",
|
|
5626
5550
|
"x-gsm": "gsm",
|
|
5627
5551
|
"x-ms-wma": "wma",
|
|
5628
5552
|
"x-ms-wax": "wax",
|
|
@@ -5648,20 +5572,11 @@ const table$1 = {
|
|
|
5648
5572
|
"vnd.nuera.ecelp9600": "ecelp9600",
|
|
5649
5573
|
"vnd.rip": "rip",
|
|
5650
5574
|
"webm": "weba",
|
|
5651
|
-
"x-aac": "aac",
|
|
5652
5575
|
"x-caf": "caf",
|
|
5653
5576
|
"x-matroska": "mka",
|
|
5654
5577
|
"x-pn-realaudio-plugin": "rmp",
|
|
5655
5578
|
"xm": "xm",
|
|
5656
|
-
"
|
|
5657
|
-
"mid",
|
|
5658
|
-
"rmi"
|
|
5659
|
-
],
|
|
5660
|
-
"aac": [
|
|
5661
|
-
"aac",
|
|
5662
|
-
"mp4",
|
|
5663
|
-
"m4a"
|
|
5664
|
-
],
|
|
5579
|
+
"aac": "aac",
|
|
5665
5580
|
"aiff": [
|
|
5666
5581
|
"aiff",
|
|
5667
5582
|
"aif",
|
|
@@ -5731,17 +5646,11 @@ const table$1 = {
|
|
|
5731
5646
|
],
|
|
5732
5647
|
"x-kinemage": "kin",
|
|
5733
5648
|
"x-macmolecule": "mcm",
|
|
5734
|
-
"x-macromodel-input":
|
|
5735
|
-
"mmd",
|
|
5736
|
-
"mmod"
|
|
5737
|
-
],
|
|
5649
|
+
"x-macromodel-input": "mmod",
|
|
5738
5650
|
"x-mdl-molfile": "mol",
|
|
5739
5651
|
"x-mdl-rdfile": "rd",
|
|
5740
5652
|
"x-mdl-rxnfile": "rxn",
|
|
5741
|
-
"x-mdl-sdfile":
|
|
5742
|
-
"sd",
|
|
5743
|
-
"sdf"
|
|
5744
|
-
],
|
|
5653
|
+
"x-mdl-sdfile": "sd",
|
|
5745
5654
|
"x-mdl-tgf": "tgf",
|
|
5746
5655
|
"x-mmcif": "mcif",
|
|
5747
5656
|
"x-mol2": "mol2",
|
|
@@ -5750,7 +5659,6 @@ const table$1 = {
|
|
|
5750
5659
|
"x-mopac-input": [
|
|
5751
5660
|
"mop",
|
|
5752
5661
|
"mopcrt",
|
|
5753
|
-
"mpc",
|
|
5754
5662
|
"zmt"
|
|
5755
5663
|
],
|
|
5756
5664
|
"x-mopac-out": "moo",
|
|
@@ -5759,14 +5667,7 @@ const table$1 = {
|
|
|
5759
5667
|
"prt",
|
|
5760
5668
|
"ent"
|
|
5761
5669
|
],
|
|
5762
|
-
"x-ncbi-asn1-binary":
|
|
5763
|
-
"val",
|
|
5764
|
-
"aso"
|
|
5765
|
-
],
|
|
5766
|
-
"x-pdb": [
|
|
5767
|
-
"pdb",
|
|
5768
|
-
"ent"
|
|
5769
|
-
],
|
|
5670
|
+
"x-ncbi-asn1-binary": "val",
|
|
5770
5671
|
"x-rosdal": "ros",
|
|
5771
5672
|
"x-swissprot": "sw",
|
|
5772
5673
|
"x-vamas-iso14976": "vms",
|
|
@@ -5786,7 +5687,6 @@ const table$1 = {
|
|
|
5786
5687
|
"jpeg",
|
|
5787
5688
|
"jpg",
|
|
5788
5689
|
"jpe",
|
|
5789
|
-
"pjpg",
|
|
5790
5690
|
"jfif",
|
|
5791
5691
|
"jfif-tbnl",
|
|
5792
5692
|
"jif"
|
|
@@ -5872,13 +5772,7 @@ const table$1 = {
|
|
|
5872
5772
|
"heic"
|
|
5873
5773
|
],
|
|
5874
5774
|
"pjpeg": [
|
|
5875
|
-
"
|
|
5876
|
-
"jpeg",
|
|
5877
|
-
"jpg",
|
|
5878
|
-
"pjpg",
|
|
5879
|
-
"jfi",
|
|
5880
|
-
"jfif-tbnl",
|
|
5881
|
-
"jif"
|
|
5775
|
+
"pjpg"
|
|
5882
5776
|
],
|
|
5883
5777
|
"vnd.adobe.photoshop": "psd",
|
|
5884
5778
|
"x-adobe-dng": "dng",
|
|
@@ -5929,10 +5823,7 @@ const table$1 = {
|
|
|
5929
5823
|
"x3dv",
|
|
5930
5824
|
"x3dvz"
|
|
5931
5825
|
],
|
|
5932
|
-
"x3d+xml":
|
|
5933
|
-
"x3d",
|
|
5934
|
-
"x3dz"
|
|
5935
|
-
],
|
|
5826
|
+
"x3d+xml": "x3dz",
|
|
5936
5827
|
"x3d+binary": [
|
|
5937
5828
|
"x3db",
|
|
5938
5829
|
"x3dbz"
|
|
@@ -5975,8 +5866,7 @@ const table$1 = {
|
|
|
5975
5866
|
"in",
|
|
5976
5867
|
"bas",
|
|
5977
5868
|
"diff",
|
|
5978
|
-
"ksh"
|
|
5979
|
-
"pl"
|
|
5869
|
+
"ksh"
|
|
5980
5870
|
],
|
|
5981
5871
|
"richtext": "rtx",
|
|
5982
5872
|
"scriptlet": [
|
|
@@ -6004,10 +5894,7 @@ const table$1 = {
|
|
|
6004
5894
|
],
|
|
6005
5895
|
"x-component": "htc",
|
|
6006
5896
|
"x-dsrc": "d",
|
|
6007
|
-
"x-diff":
|
|
6008
|
-
"diff",
|
|
6009
|
-
"patch"
|
|
6010
|
-
],
|
|
5897
|
+
"x-diff": "patch",
|
|
6011
5898
|
"x-haskell": "hs",
|
|
6012
5899
|
"x-java": "java",
|
|
6013
5900
|
"x-literate-haskell": "lhs",
|
|
@@ -6019,10 +5906,6 @@ const table$1 = {
|
|
|
6019
5906
|
"inc"
|
|
6020
5907
|
],
|
|
6021
5908
|
"x-pcs-gcd": "gcd",
|
|
6022
|
-
"x-perl": [
|
|
6023
|
-
"pl",
|
|
6024
|
-
"pm"
|
|
6025
|
-
],
|
|
6026
5909
|
"x-python": "py",
|
|
6027
5910
|
"x-scala": "scala",
|
|
6028
5911
|
"x-setext": "etx",
|
|
@@ -6075,11 +5958,7 @@ const table$1 = {
|
|
|
6075
5958
|
],
|
|
6076
5959
|
"x-c": [
|
|
6077
5960
|
"c",
|
|
6078
|
-
"cc",
|
|
6079
|
-
"cxx",
|
|
6080
|
-
"cpp",
|
|
6081
5961
|
"h",
|
|
6082
|
-
"hh",
|
|
6083
5962
|
"dic"
|
|
6084
5963
|
],
|
|
6085
5964
|
"x-fortran": [
|
|
@@ -6102,13 +5981,7 @@ const table$1 = {
|
|
|
6102
5981
|
"markdn"
|
|
6103
5982
|
],
|
|
6104
5983
|
"vnd.wap.si": "si",
|
|
6105
|
-
"vnd.wap.sl": "sl"
|
|
6106
|
-
"x-markdown": [
|
|
6107
|
-
"md",
|
|
6108
|
-
"markdown",
|
|
6109
|
-
"mdown",
|
|
6110
|
-
"markdn"
|
|
6111
|
-
]
|
|
5984
|
+
"vnd.wap.sl": "sl"
|
|
6112
5985
|
},
|
|
6113
5986
|
"video": {
|
|
6114
5987
|
"avif": "avif",
|
|
@@ -6222,8 +6095,6 @@ const table$1 = {
|
|
|
6222
6095
|
"x-world": {
|
|
6223
6096
|
"x-vrml": [
|
|
6224
6097
|
"vrm",
|
|
6225
|
-
"vrml",
|
|
6226
|
-
"wrl",
|
|
6227
6098
|
"flr",
|
|
6228
6099
|
"wrz",
|
|
6229
6100
|
"xaf",
|
|
@@ -9503,7 +9374,7 @@ class ZipEntry$1 {
|
|
|
9503
9374
|
localDirectory.rawExtraField = localDirectory.extraFieldLength ?
|
|
9504
9375
|
await readUint8Array(reader, offset + 30 + localDirectory.filenameLength, localDirectory.extraFieldLength, diskNumberStart) :
|
|
9505
9376
|
new Uint8Array();
|
|
9506
|
-
await readCommonFooter(zipEntry, localDirectory, dataView, 4);
|
|
9377
|
+
await readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
|
|
9507
9378
|
Object.assign(fileEntry, {
|
|
9508
9379
|
lastAccessDate: localDirectory.lastAccessDate,
|
|
9509
9380
|
creationDate: localDirectory.creationDate
|
|
@@ -9590,7 +9461,7 @@ function readCommonHeader(directory, dataView, offset) {
|
|
|
9590
9461
|
});
|
|
9591
9462
|
}
|
|
9592
9463
|
|
|
9593
|
-
async function readCommonFooter(fileEntry, directory, dataView, offset) {
|
|
9464
|
+
async function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) {
|
|
9594
9465
|
const { rawExtraField } = directory;
|
|
9595
9466
|
const extraField = directory.extraField = new Map();
|
|
9596
9467
|
const rawExtraFieldView = getDataView$1(new Uint8Array(rawExtraField));
|
|
@@ -9643,7 +9514,7 @@ async function readCommonFooter(fileEntry, directory, dataView, offset) {
|
|
|
9643
9514
|
}
|
|
9644
9515
|
const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
9645
9516
|
if (extraFieldExtendedTimestamp) {
|
|
9646
|
-
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory);
|
|
9517
|
+
readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
|
|
9647
9518
|
directory.extraFieldExtendedTimestamp = extraFieldExtendedTimestamp;
|
|
9648
9519
|
}
|
|
9649
9520
|
}
|
|
@@ -9734,23 +9605,28 @@ function readExtraFieldNTFS(extraFieldNTFS, directory) {
|
|
|
9734
9605
|
}
|
|
9735
9606
|
}
|
|
9736
9607
|
|
|
9737
|
-
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory) {
|
|
9608
|
+
function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory) {
|
|
9738
9609
|
const extraFieldView = getDataView$1(extraFieldExtendedTimestamp.data);
|
|
9739
9610
|
const flags = getUint8(extraFieldView, 0);
|
|
9740
9611
|
const timeProperties = [];
|
|
9741
9612
|
const timeRawProperties = [];
|
|
9742
|
-
if (
|
|
9613
|
+
if (localDirectory) {
|
|
9614
|
+
if ((flags & 0x1) == 0x1) {
|
|
9615
|
+
timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
|
|
9616
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
|
|
9617
|
+
}
|
|
9618
|
+
if ((flags & 0x2) == 0x2) {
|
|
9619
|
+
timeProperties.push(PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
9620
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_ACCESS_DATE);
|
|
9621
|
+
}
|
|
9622
|
+
if ((flags & 0x4) == 0x4) {
|
|
9623
|
+
timeProperties.push(PROPERTY_NAME_CREATION_DATE);
|
|
9624
|
+
timeRawProperties.push(PROPERTY_NAME_RAW_CREATION_DATE);
|
|
9625
|
+
}
|
|
9626
|
+
} else if (extraFieldExtendedTimestamp.data.length >= 5) {
|
|
9743
9627
|
timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
|
|
9744
9628
|
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
|
|
9745
9629
|
}
|
|
9746
|
-
if ((flags & 0x2) == 0x2) {
|
|
9747
|
-
timeProperties.push(PROPERTY_NAME_LAST_ACCESS_DATE);
|
|
9748
|
-
timeRawProperties.push(PROPERTY_NAME_RAW_LAST_ACCESS_DATE);
|
|
9749
|
-
}
|
|
9750
|
-
if ((flags & 0x4) == 0x4) {
|
|
9751
|
-
timeProperties.push(PROPERTY_NAME_CREATION_DATE);
|
|
9752
|
-
timeRawProperties.push(PROPERTY_NAME_RAW_CREATION_DATE);
|
|
9753
|
-
}
|
|
9754
9630
|
let offset = 1;
|
|
9755
9631
|
timeProperties.forEach((propertyName, indexProperty) => {
|
|
9756
9632
|
if (extraFieldExtendedTimestamp.data.length >= offset + 4) {
|
|
@@ -10233,6 +10109,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10233
10109
|
version,
|
|
10234
10110
|
compressionMethod,
|
|
10235
10111
|
rawExtraFieldExtendedTimestamp,
|
|
10112
|
+
extraFieldExtendedTimestampFlag,
|
|
10236
10113
|
rawExtraFieldNTFS,
|
|
10237
10114
|
rawExtraFieldAES
|
|
10238
10115
|
} = headerInfo;
|
|
@@ -10364,6 +10241,7 @@ async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryI
|
|
|
10364
10241
|
headerArray,
|
|
10365
10242
|
signature,
|
|
10366
10243
|
rawExtraFieldZip64,
|
|
10244
|
+
extraFieldExtendedTimestampFlag,
|
|
10367
10245
|
zip64UncompressedSize,
|
|
10368
10246
|
zip64CompressedSize,
|
|
10369
10247
|
zip64Offset,
|
|
@@ -10386,7 +10264,7 @@ function getHeaderInfo(options) {
|
|
|
10386
10264
|
directory,
|
|
10387
10265
|
rawExtraField,
|
|
10388
10266
|
encryptionStrength,
|
|
10389
|
-
extendedTimestamp
|
|
10267
|
+
extendedTimestamp
|
|
10390
10268
|
} = options;
|
|
10391
10269
|
const compressed = level !== 0 && !directory;
|
|
10392
10270
|
const encrypted = Boolean(password && getLength(password));
|
|
@@ -10403,19 +10281,23 @@ function getHeaderInfo(options) {
|
|
|
10403
10281
|
}
|
|
10404
10282
|
let rawExtraFieldNTFS;
|
|
10405
10283
|
let rawExtraFieldExtendedTimestamp;
|
|
10284
|
+
let extraFieldExtendedTimestampFlag;
|
|
10406
10285
|
if (extendedTimestamp) {
|
|
10407
10286
|
rawExtraFieldExtendedTimestamp = new Uint8Array(9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0));
|
|
10408
10287
|
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
|
|
10409
10288
|
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
10410
10289
|
setUint16(extraFieldExtendedTimestampView, 2, getLength(rawExtraFieldExtendedTimestamp) - 4);
|
|
10411
|
-
|
|
10290
|
+
extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
|
|
10412
10291
|
setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
|
|
10413
|
-
|
|
10292
|
+
let offset = 5;
|
|
10293
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastModDate.getTime() / 1000));
|
|
10294
|
+
offset += 4;
|
|
10414
10295
|
if (lastAccessDate) {
|
|
10415
|
-
setUint32(extraFieldExtendedTimestampView,
|
|
10296
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastAccessDate.getTime() / 1000));
|
|
10297
|
+
offset += 4;
|
|
10416
10298
|
}
|
|
10417
10299
|
if (creationDate) {
|
|
10418
|
-
setUint32(extraFieldExtendedTimestampView,
|
|
10300
|
+
setUint32(extraFieldExtendedTimestampView, offset, Math.floor(creationDate.getTime() / 1000));
|
|
10419
10301
|
}
|
|
10420
10302
|
try {
|
|
10421
10303
|
rawExtraFieldNTFS = new Uint8Array(36);
|
|
@@ -10496,6 +10378,7 @@ function getHeaderInfo(options) {
|
|
|
10496
10378
|
compressed,
|
|
10497
10379
|
version,
|
|
10498
10380
|
compressionMethod,
|
|
10381
|
+
extraFieldExtendedTimestampFlag,
|
|
10499
10382
|
rawExtraFieldExtendedTimestamp,
|
|
10500
10383
|
rawExtraFieldNTFS,
|
|
10501
10384
|
rawExtraFieldAES
|
|
@@ -10632,23 +10515,38 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
10632
10515
|
let directoryDataLength = 0;
|
|
10633
10516
|
let directoryOffset = zipWriter.offset - diskOffset;
|
|
10634
10517
|
let filesLength = files.size;
|
|
10635
|
-
for (const [, {
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10518
|
+
for (const [, fileEntry] of files) {
|
|
10519
|
+
const {
|
|
10520
|
+
rawFilename,
|
|
10521
|
+
rawExtraFieldZip64,
|
|
10522
|
+
rawExtraFieldAES,
|
|
10523
|
+
rawComment,
|
|
10524
|
+
rawExtraFieldNTFS,
|
|
10525
|
+
rawExtraField,
|
|
10526
|
+
extendedTimestamp,
|
|
10527
|
+
extraFieldExtendedTimestampFlag,
|
|
10528
|
+
lastModDate
|
|
10529
|
+
} = fileEntry;
|
|
10530
|
+
let rawExtraFieldTimestamp;
|
|
10531
|
+
if (extendedTimestamp) {
|
|
10532
|
+
rawExtraFieldTimestamp = new Uint8Array(9);
|
|
10533
|
+
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldTimestamp);
|
|
10534
|
+
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
10535
|
+
setUint16(extraFieldExtendedTimestampView, 2, 5);
|
|
10536
|
+
setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
|
|
10537
|
+
setUint32(extraFieldExtendedTimestampView, 5, Math.floor(lastModDate.getTime() / 1000));
|
|
10538
|
+
} else {
|
|
10539
|
+
rawExtraFieldTimestamp = new Uint8Array();
|
|
10540
|
+
}
|
|
10541
|
+
fileEntry.rawExtraFieldCDExtendedTimestamp = rawExtraFieldTimestamp;
|
|
10644
10542
|
directoryDataLength += 46 +
|
|
10645
10543
|
getLength(
|
|
10646
10544
|
rawFilename,
|
|
10647
10545
|
rawComment,
|
|
10648
10546
|
rawExtraFieldZip64,
|
|
10649
10547
|
rawExtraFieldAES,
|
|
10650
|
-
rawExtraFieldExtendedTimestamp,
|
|
10651
10548
|
rawExtraFieldNTFS,
|
|
10549
|
+
rawExtraFieldTimestamp,
|
|
10652
10550
|
rawExtraField);
|
|
10653
10551
|
}
|
|
10654
10552
|
const directoryArray = new Uint8Array(directoryDataLength);
|
|
@@ -10661,6 +10559,7 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
10661
10559
|
rawFilename,
|
|
10662
10560
|
rawExtraFieldZip64,
|
|
10663
10561
|
rawExtraFieldAES,
|
|
10562
|
+
rawExtraFieldCDExtendedTimestamp,
|
|
10664
10563
|
rawExtraFieldNTFS,
|
|
10665
10564
|
rawExtraField,
|
|
10666
10565
|
rawComment,
|
|
@@ -10675,24 +10574,11 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
10675
10574
|
msDosCompatible,
|
|
10676
10575
|
internalFileAttribute,
|
|
10677
10576
|
externalFileAttribute,
|
|
10678
|
-
extendedTimestamp,
|
|
10679
|
-
lastModDate,
|
|
10680
10577
|
diskNumberStart,
|
|
10681
10578
|
uncompressedSize,
|
|
10682
10579
|
compressedSize
|
|
10683
10580
|
} = fileEntry;
|
|
10684
|
-
|
|
10685
|
-
if (extendedTimestamp) {
|
|
10686
|
-
rawExtraFieldExtendedTimestamp = new Uint8Array(9);
|
|
10687
|
-
const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
|
|
10688
|
-
setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
|
|
10689
|
-
setUint16(extraFieldExtendedTimestampView, 2, getLength(rawExtraFieldExtendedTimestamp) - 4);
|
|
10690
|
-
setUint8(extraFieldExtendedTimestampView, 4, 0x1);
|
|
10691
|
-
setUint32(extraFieldExtendedTimestampView, 5, Math.floor(lastModDate.getTime() / 1000));
|
|
10692
|
-
} else {
|
|
10693
|
-
rawExtraFieldExtendedTimestamp = new Uint8Array();
|
|
10694
|
-
}
|
|
10695
|
-
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraField);
|
|
10581
|
+
const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp, rawExtraFieldNTFS, rawExtraField);
|
|
10696
10582
|
setUint32(directoryView, offset, CENTRAL_FILE_HEADER_SIGNATURE);
|
|
10697
10583
|
setUint16(directoryView, offset + 4, versionMadeBy);
|
|
10698
10584
|
const headerView = getDataView(headerArray);
|
|
@@ -10716,9 +10602,9 @@ async function closeFile(zipWriter, comment, options) {
|
|
|
10716
10602
|
arraySet(directoryArray, rawFilename, offset + 46);
|
|
10717
10603
|
arraySet(directoryArray, rawExtraFieldZip64, offset + 46 + getLength(rawFilename));
|
|
10718
10604
|
arraySet(directoryArray, rawExtraFieldAES, offset + 46 + getLength(rawFilename, rawExtraFieldZip64));
|
|
10719
|
-
arraySet(directoryArray,
|
|
10720
|
-
arraySet(directoryArray, rawExtraFieldNTFS, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES,
|
|
10721
|
-
arraySet(directoryArray, rawExtraField, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES,
|
|
10605
|
+
arraySet(directoryArray, rawExtraFieldCDExtendedTimestamp, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES));
|
|
10606
|
+
arraySet(directoryArray, rawExtraFieldNTFS, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp));
|
|
10607
|
+
arraySet(directoryArray, rawExtraField, offset + 46 + getLength(rawFilename, rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldCDExtendedTimestamp, rawExtraFieldNTFS));
|
|
10722
10608
|
arraySet(directoryArray, rawComment, offset + 46 + getLength(rawFilename) + extraFieldLength);
|
|
10723
10609
|
const directoryEntryLength = 46 + getLength(rawFilename, rawComment) + extraFieldLength;
|
|
10724
10610
|
if (offset - directoryDiskOffset > writer.availableSize) {
|
|
@@ -11539,26 +11425,29 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
11539
11425
|
|
|
11540
11426
|
async function processChild(child) {
|
|
11541
11427
|
const name = options.relativePath ? child.getRelativeName(selectedEntry) : child.getFullname();
|
|
11542
|
-
let externalFileAttribute;
|
|
11543
|
-
let versionMadeBy;
|
|
11544
|
-
let comment;
|
|
11545
|
-
let lastModDate;
|
|
11546
11428
|
let childOptions = child.options || {};
|
|
11429
|
+
let zipEntryOptions = {};
|
|
11547
11430
|
if (child.data instanceof Entry) {
|
|
11548
|
-
|
|
11431
|
+
const {
|
|
11432
|
+
externalFileAttribute,
|
|
11433
|
+
versionMadeBy,
|
|
11434
|
+
comment,
|
|
11435
|
+
lastModDate,
|
|
11436
|
+
creationDate,
|
|
11437
|
+
lastAccessDate
|
|
11438
|
+
} = child.data;
|
|
11439
|
+
zipEntryOptions = {
|
|
11549
11440
|
externalFileAttribute,
|
|
11550
11441
|
versionMadeBy,
|
|
11551
11442
|
comment,
|
|
11552
|
-
lastModDate
|
|
11553
|
-
|
|
11443
|
+
lastModDate,
|
|
11444
|
+
creationDate,
|
|
11445
|
+
lastAccessDate
|
|
11446
|
+
};
|
|
11554
11447
|
}
|
|
11555
11448
|
await zipWriter.add(name, child.reader, Object.assign({
|
|
11556
11449
|
directory: child.directory
|
|
11557
|
-
}, Object.assign({}, options, {
|
|
11558
|
-
externalFileAttribute,
|
|
11559
|
-
versionMadeBy,
|
|
11560
|
-
comment,
|
|
11561
|
-
lastModDate,
|
|
11450
|
+
}, Object.assign({}, options, zipEntryOptions, childOptions, {
|
|
11562
11451
|
onprogress: async indexProgress => {
|
|
11563
11452
|
if (options.onprogress) {
|
|
11564
11453
|
entryOffsets.set(name, indexProgress);
|
|
@@ -11569,7 +11458,7 @@ async function exportZip(zipWriter, entry, totalSize, options) {
|
|
|
11569
11458
|
}
|
|
11570
11459
|
}
|
|
11571
11460
|
}
|
|
11572
|
-
}
|
|
11461
|
+
})));
|
|
11573
11462
|
await process(zipWriter, child);
|
|
11574
11463
|
}
|
|
11575
11464
|
}
|
package/index.d.ts
CHANGED
|
@@ -1545,7 +1545,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1545
1545
|
* @returns A promise resolving to a {@link ZipFileEntry} or a {@link ZipDirectoryEntry} instance.
|
|
1546
1546
|
*/
|
|
1547
1547
|
addFile(
|
|
1548
|
-
file: File,
|
|
1548
|
+
file: File,
|
|
1549
1549
|
options?: ZipWriterAddDataOptions,
|
|
1550
1550
|
): Promise<ZipEntry>;
|
|
1551
1551
|
/**
|