index.mjs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. const mimes = {
  2. "3g2": "video/3gpp2",
  3. "3gp": "video/3gpp",
  4. "3gpp": "video/3gpp",
  5. "3mf": "model/3mf",
  6. "aac": "audio/aac",
  7. "ac": "application/pkix-attr-cert",
  8. "adp": "audio/adpcm",
  9. "adts": "audio/aac",
  10. "ai": "application/postscript",
  11. "aml": "application/automationml-aml+xml",
  12. "amlx": "application/automationml-amlx+zip",
  13. "amr": "audio/amr",
  14. "apng": "image/apng",
  15. "appcache": "text/cache-manifest",
  16. "appinstaller": "application/appinstaller",
  17. "appx": "application/appx",
  18. "appxbundle": "application/appxbundle",
  19. "asc": "application/pgp-keys",
  20. "atom": "application/atom+xml",
  21. "atomcat": "application/atomcat+xml",
  22. "atomdeleted": "application/atomdeleted+xml",
  23. "atomsvc": "application/atomsvc+xml",
  24. "au": "audio/basic",
  25. "avci": "image/avci",
  26. "avcs": "image/avcs",
  27. "avif": "image/avif",
  28. "aw": "application/applixware",
  29. "bdoc": "application/bdoc",
  30. "bin": "application/octet-stream",
  31. "bmp": "image/bmp",
  32. "bpk": "application/octet-stream",
  33. "btf": "image/prs.btif",
  34. "btif": "image/prs.btif",
  35. "buffer": "application/octet-stream",
  36. "ccxml": "application/ccxml+xml",
  37. "cdfx": "application/cdfx+xml",
  38. "cdmia": "application/cdmi-capability",
  39. "cdmic": "application/cdmi-container",
  40. "cdmid": "application/cdmi-domain",
  41. "cdmio": "application/cdmi-object",
  42. "cdmiq": "application/cdmi-queue",
  43. "cer": "application/pkix-cert",
  44. "cgm": "image/cgm",
  45. "cjs": "application/node",
  46. "class": "application/java-vm",
  47. "coffee": "text/coffeescript",
  48. "conf": "text/plain",
  49. "cpl": "application/cpl+xml",
  50. "cpt": "application/mac-compactpro",
  51. "crl": "application/pkix-crl",
  52. "css": "text/css",
  53. "csv": "text/csv",
  54. "cu": "application/cu-seeme",
  55. "cwl": "application/cwl",
  56. "cww": "application/prs.cww",
  57. "davmount": "application/davmount+xml",
  58. "dbk": "application/docbook+xml",
  59. "deb": "application/octet-stream",
  60. "def": "text/plain",
  61. "deploy": "application/octet-stream",
  62. "dib": "image/bmp",
  63. "disposition-notification": "message/disposition-notification",
  64. "dist": "application/octet-stream",
  65. "distz": "application/octet-stream",
  66. "dll": "application/octet-stream",
  67. "dmg": "application/octet-stream",
  68. "dms": "application/octet-stream",
  69. "doc": "application/msword",
  70. "dot": "application/msword",
  71. "dpx": "image/dpx",
  72. "drle": "image/dicom-rle",
  73. "dsc": "text/prs.lines.tag",
  74. "dssc": "application/dssc+der",
  75. "dtd": "application/xml-dtd",
  76. "dump": "application/octet-stream",
  77. "dwd": "application/atsc-dwd+xml",
  78. "ear": "application/java-archive",
  79. "ecma": "application/ecmascript",
  80. "elc": "application/octet-stream",
  81. "emf": "image/emf",
  82. "eml": "message/rfc822",
  83. "emma": "application/emma+xml",
  84. "emotionml": "application/emotionml+xml",
  85. "eps": "application/postscript",
  86. "epub": "application/epub+zip",
  87. "exe": "application/octet-stream",
  88. "exi": "application/exi",
  89. "exp": "application/express",
  90. "exr": "image/aces",
  91. "ez": "application/andrew-inset",
  92. "fdf": "application/fdf",
  93. "fdt": "application/fdt+xml",
  94. "fits": "image/fits",
  95. "g3": "image/g3fax",
  96. "gbr": "application/rpki-ghostbusters",
  97. "geojson": "application/geo+json",
  98. "gif": "image/gif",
  99. "glb": "model/gltf-binary",
  100. "gltf": "model/gltf+json",
  101. "gml": "application/gml+xml",
  102. "gpx": "application/gpx+xml",
  103. "gram": "application/srgs",
  104. "grxml": "application/srgs+xml",
  105. "gxf": "application/gxf",
  106. "gz": "application/gzip",
  107. "h261": "video/h261",
  108. "h263": "video/h263",
  109. "h264": "video/h264",
  110. "heic": "image/heic",
  111. "heics": "image/heic-sequence",
  112. "heif": "image/heif",
  113. "heifs": "image/heif-sequence",
  114. "hej2": "image/hej2k",
  115. "held": "application/atsc-held+xml",
  116. "hjson": "application/hjson",
  117. "hlp": "application/winhlp",
  118. "hqx": "application/mac-binhex40",
  119. "hsj2": "image/hsj2",
  120. "htm": "text/html",
  121. "html": "text/html",
  122. "ics": "text/calendar",
  123. "ief": "image/ief",
  124. "ifb": "text/calendar",
  125. "iges": "model/iges",
  126. "igs": "model/iges",
  127. "img": "application/octet-stream",
  128. "in": "text/plain",
  129. "ini": "text/plain",
  130. "ink": "application/inkml+xml",
  131. "inkml": "application/inkml+xml",
  132. "ipfix": "application/ipfix",
  133. "iso": "application/octet-stream",
  134. "its": "application/its+xml",
  135. "jade": "text/jade",
  136. "jar": "application/java-archive",
  137. "jhc": "image/jphc",
  138. "jls": "image/jls",
  139. "jp2": "image/jp2",
  140. "jpe": "image/jpeg",
  141. "jpeg": "image/jpeg",
  142. "jpf": "image/jpx",
  143. "jpg": "image/jpeg",
  144. "jpg2": "image/jp2",
  145. "jpgm": "image/jpm",
  146. "jpgv": "video/jpeg",
  147. "jph": "image/jph",
  148. "jpm": "image/jpm",
  149. "jpx": "image/jpx",
  150. "js": "text/javascript",
  151. "json": "application/json",
  152. "json5": "application/json5",
  153. "jsonld": "application/ld+json",
  154. "jsonml": "application/jsonml+json",
  155. "jsx": "text/jsx",
  156. "jt": "model/jt",
  157. "jxr": "image/jxr",
  158. "jxra": "image/jxra",
  159. "jxrs": "image/jxrs",
  160. "jxs": "image/jxs",
  161. "jxsc": "image/jxsc",
  162. "jxsi": "image/jxsi",
  163. "jxss": "image/jxss",
  164. "kar": "audio/midi",
  165. "ktx": "image/ktx",
  166. "ktx2": "image/ktx2",
  167. "less": "text/less",
  168. "lgr": "application/lgr+xml",
  169. "list": "text/plain",
  170. "litcoffee": "text/coffeescript",
  171. "log": "text/plain",
  172. "lostxml": "application/lost+xml",
  173. "lrf": "application/octet-stream",
  174. "m1v": "video/mpeg",
  175. "m21": "application/mp21",
  176. "m2a": "audio/mpeg",
  177. "m2v": "video/mpeg",
  178. "m3a": "audio/mpeg",
  179. "m4a": "audio/mp4",
  180. "m4p": "application/mp4",
  181. "m4s": "video/iso.segment",
  182. "ma": "application/mathematica",
  183. "mads": "application/mads+xml",
  184. "maei": "application/mmt-aei+xml",
  185. "man": "text/troff",
  186. "manifest": "text/cache-manifest",
  187. "map": "application/json",
  188. "mar": "application/octet-stream",
  189. "markdown": "text/markdown",
  190. "mathml": "application/mathml+xml",
  191. "mb": "application/mathematica",
  192. "mbox": "application/mbox",
  193. "md": "text/markdown",
  194. "mdx": "text/mdx",
  195. "me": "text/troff",
  196. "mesh": "model/mesh",
  197. "meta4": "application/metalink4+xml",
  198. "metalink": "application/metalink+xml",
  199. "mets": "application/mets+xml",
  200. "mft": "application/rpki-manifest",
  201. "mid": "audio/midi",
  202. "midi": "audio/midi",
  203. "mime": "message/rfc822",
  204. "mj2": "video/mj2",
  205. "mjp2": "video/mj2",
  206. "mjs": "text/javascript",
  207. "mml": "text/mathml",
  208. "mods": "application/mods+xml",
  209. "mov": "video/quicktime",
  210. "mp2": "audio/mpeg",
  211. "mp21": "application/mp21",
  212. "mp2a": "audio/mpeg",
  213. "mp3": "audio/mpeg",
  214. "mp4": "video/mp4",
  215. "mp4a": "audio/mp4",
  216. "mp4s": "application/mp4",
  217. "mp4v": "video/mp4",
  218. "mpd": "application/dash+xml",
  219. "mpe": "video/mpeg",
  220. "mpeg": "video/mpeg",
  221. "mpf": "application/media-policy-dataset+xml",
  222. "mpg": "video/mpeg",
  223. "mpg4": "video/mp4",
  224. "mpga": "audio/mpeg",
  225. "mpp": "application/dash-patch+xml",
  226. "mrc": "application/marc",
  227. "mrcx": "application/marcxml+xml",
  228. "ms": "text/troff",
  229. "mscml": "application/mediaservercontrol+xml",
  230. "msh": "model/mesh",
  231. "msi": "application/octet-stream",
  232. "msix": "application/msix",
  233. "msixbundle": "application/msixbundle",
  234. "msm": "application/octet-stream",
  235. "msp": "application/octet-stream",
  236. "mtl": "model/mtl",
  237. "musd": "application/mmt-usd+xml",
  238. "mxf": "application/mxf",
  239. "mxmf": "audio/mobile-xmf",
  240. "mxml": "application/xv+xml",
  241. "n3": "text/n3",
  242. "nb": "application/mathematica",
  243. "nq": "application/n-quads",
  244. "nt": "application/n-triples",
  245. "obj": "model/obj",
  246. "oda": "application/oda",
  247. "oga": "audio/ogg",
  248. "ogg": "audio/ogg",
  249. "ogv": "video/ogg",
  250. "ogx": "application/ogg",
  251. "omdoc": "application/omdoc+xml",
  252. "onepkg": "application/onenote",
  253. "onetmp": "application/onenote",
  254. "onetoc": "application/onenote",
  255. "onetoc2": "application/onenote",
  256. "opf": "application/oebps-package+xml",
  257. "opus": "audio/ogg",
  258. "otf": "font/otf",
  259. "owl": "application/rdf+xml",
  260. "oxps": "application/oxps",
  261. "p10": "application/pkcs10",
  262. "p7c": "application/pkcs7-mime",
  263. "p7m": "application/pkcs7-mime",
  264. "p7s": "application/pkcs7-signature",
  265. "p8": "application/pkcs8",
  266. "pdf": "application/pdf",
  267. "pfr": "application/font-tdpfr",
  268. "pgp": "application/pgp-encrypted",
  269. "pkg": "application/octet-stream",
  270. "pki": "application/pkixcmp",
  271. "pkipath": "application/pkix-pkipath",
  272. "pls": "application/pls+xml",
  273. "png": "image/png",
  274. "prc": "model/prc",
  275. "prf": "application/pics-rules",
  276. "provx": "application/provenance+xml",
  277. "ps": "application/postscript",
  278. "pskcxml": "application/pskc+xml",
  279. "pti": "image/prs.pti",
  280. "qt": "video/quicktime",
  281. "raml": "application/raml+yaml",
  282. "rapd": "application/route-apd+xml",
  283. "rdf": "application/rdf+xml",
  284. "relo": "application/p2p-overlay+xml",
  285. "rif": "application/reginfo+xml",
  286. "rl": "application/resource-lists+xml",
  287. "rld": "application/resource-lists-diff+xml",
  288. "rmi": "audio/midi",
  289. "rnc": "application/relax-ng-compact-syntax",
  290. "rng": "application/xml",
  291. "roa": "application/rpki-roa",
  292. "roff": "text/troff",
  293. "rq": "application/sparql-query",
  294. "rs": "application/rls-services+xml",
  295. "rsat": "application/atsc-rsat+xml",
  296. "rsd": "application/rsd+xml",
  297. "rsheet": "application/urc-ressheet+xml",
  298. "rss": "application/rss+xml",
  299. "rtf": "text/rtf",
  300. "rtx": "text/richtext",
  301. "rusd": "application/route-usd+xml",
  302. "s3m": "audio/s3m",
  303. "sbml": "application/sbml+xml",
  304. "scq": "application/scvp-cv-request",
  305. "scs": "application/scvp-cv-response",
  306. "sdp": "application/sdp",
  307. "senmlx": "application/senml+xml",
  308. "sensmlx": "application/sensml+xml",
  309. "ser": "application/java-serialized-object",
  310. "setpay": "application/set-payment-initiation",
  311. "setreg": "application/set-registration-initiation",
  312. "sgi": "image/sgi",
  313. "sgm": "text/sgml",
  314. "sgml": "text/sgml",
  315. "shex": "text/shex",
  316. "shf": "application/shf+xml",
  317. "shtml": "text/html",
  318. "sieve": "application/sieve",
  319. "sig": "application/pgp-signature",
  320. "sil": "audio/silk",
  321. "silo": "model/mesh",
  322. "siv": "application/sieve",
  323. "slim": "text/slim",
  324. "slm": "text/slim",
  325. "sls": "application/route-s-tsid+xml",
  326. "smi": "application/smil+xml",
  327. "smil": "application/smil+xml",
  328. "snd": "audio/basic",
  329. "so": "application/octet-stream",
  330. "spdx": "text/spdx",
  331. "spp": "application/scvp-vp-response",
  332. "spq": "application/scvp-vp-request",
  333. "spx": "audio/ogg",
  334. "sql": "application/sql",
  335. "sru": "application/sru+xml",
  336. "srx": "application/sparql-results+xml",
  337. "ssdl": "application/ssdl+xml",
  338. "ssml": "application/ssml+xml",
  339. "stk": "application/hyperstudio",
  340. "stl": "model/stl",
  341. "stpx": "model/step+xml",
  342. "stpxz": "model/step-xml+zip",
  343. "stpz": "model/step+zip",
  344. "styl": "text/stylus",
  345. "stylus": "text/stylus",
  346. "svg": "image/svg+xml",
  347. "svgz": "image/svg+xml",
  348. "swidtag": "application/swid+xml",
  349. "t": "text/troff",
  350. "t38": "image/t38",
  351. "td": "application/urc-targetdesc+xml",
  352. "tei": "application/tei+xml",
  353. "teicorpus": "application/tei+xml",
  354. "text": "text/plain",
  355. "tfi": "application/thraud+xml",
  356. "tfx": "image/tiff-fx",
  357. "tif": "image/tiff",
  358. "tiff": "image/tiff",
  359. "toml": "application/toml",
  360. "tr": "text/troff",
  361. "trig": "application/trig",
  362. "ts": "video/mp2t",
  363. "tsd": "application/timestamped-data",
  364. "tsv": "text/tab-separated-values",
  365. "ttc": "font/collection",
  366. "ttf": "font/ttf",
  367. "ttl": "text/turtle",
  368. "ttml": "application/ttml+xml",
  369. "txt": "text/plain",
  370. "u3d": "model/u3d",
  371. "u8dsn": "message/global-delivery-status",
  372. "u8hdr": "message/global-headers",
  373. "u8mdn": "message/global-disposition-notification",
  374. "u8msg": "message/global",
  375. "ubj": "application/ubjson",
  376. "uri": "text/uri-list",
  377. "uris": "text/uri-list",
  378. "urls": "text/uri-list",
  379. "vcard": "text/vcard",
  380. "vrml": "model/vrml",
  381. "vtt": "text/vtt",
  382. "vxml": "application/voicexml+xml",
  383. "war": "application/java-archive",
  384. "wasm": "application/wasm",
  385. "wav": "audio/wav",
  386. "weba": "audio/webm",
  387. "webm": "video/webm",
  388. "webmanifest": "application/manifest+json",
  389. "webp": "image/webp",
  390. "wgsl": "text/wgsl",
  391. "wgt": "application/widget",
  392. "wif": "application/watcherinfo+xml",
  393. "wmf": "image/wmf",
  394. "woff": "font/woff",
  395. "woff2": "font/woff2",
  396. "wrl": "model/vrml",
  397. "wsdl": "application/wsdl+xml",
  398. "wspolicy": "application/wspolicy+xml",
  399. "x3d": "model/x3d+xml",
  400. "x3db": "model/x3d+fastinfoset",
  401. "x3dbz": "model/x3d+binary",
  402. "x3dv": "model/x3d-vrml",
  403. "x3dvz": "model/x3d+vrml",
  404. "x3dz": "model/x3d+xml",
  405. "xaml": "application/xaml+xml",
  406. "xav": "application/xcap-att+xml",
  407. "xca": "application/xcap-caps+xml",
  408. "xcs": "application/calendar+xml",
  409. "xdf": "application/xcap-diff+xml",
  410. "xdssc": "application/dssc+xml",
  411. "xel": "application/xcap-el+xml",
  412. "xenc": "application/xenc+xml",
  413. "xer": "application/patch-ops-error+xml",
  414. "xfdf": "application/xfdf",
  415. "xht": "application/xhtml+xml",
  416. "xhtml": "application/xhtml+xml",
  417. "xhvml": "application/xv+xml",
  418. "xlf": "application/xliff+xml",
  419. "xm": "audio/xm",
  420. "xml": "text/xml",
  421. "xns": "application/xcap-ns+xml",
  422. "xop": "application/xop+xml",
  423. "xpl": "application/xproc+xml",
  424. "xsd": "application/xml",
  425. "xsf": "application/prs.xsf+xml",
  426. "xsl": "application/xml",
  427. "xslt": "application/xml",
  428. "xspf": "application/xspf+xml",
  429. "xvm": "application/xv+xml",
  430. "xvml": "application/xv+xml",
  431. "yaml": "text/yaml",
  432. "yang": "application/yang",
  433. "yin": "application/yin+xml",
  434. "yml": "text/yaml",
  435. "zip": "application/zip"
  436. };
  437. function lookup(extn) {
  438. let tmp = ('' + extn).trim().toLowerCase();
  439. let idx = tmp.lastIndexOf('.');
  440. return mimes[!~idx ? tmp : tmp.substring(++idx)];
  441. }
  442. export { mimes, lookup };