-
Notifications
You must be signed in to change notification settings - Fork 0
/
media_types.ts
136 lines (135 loc) · 4.67 KB
/
media_types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* Gets the media type by file extension string.
*/
export function getMediaType(ext?: string) {
return (ext && MEDIA_TYPES[ext]) ?? "application/octet-stream";
}
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
// Copied from https://github.com/denoland/deno_std/blob/2cbf6c7eb80073a442328d004e484848d437d862/http/file_server.ts
const MEDIA_TYPES: Record<string, string | undefined> = {
".md": "text/markdown",
".html": "text/html",
".htm": "text/html",
".json": "application/json",
".map": "application/json",
".txt": "text/plain",
".ts": "text/typescript",
".tsx": "text/tsx",
".js": "application/javascript",
".jsx": "text/jsx",
".gz": "application/gzip",
".css": "text/css",
".wasm": "application/wasm",
".mjs": "application/javascript",
".otf": "font/otf",
".ttf": "font/ttf",
".woff": "font/woff",
".woff2": "font/woff2",
".conf": "text/plain",
".list": "textplain",
".log": "text/plain",
".ini": "text/plain",
".vtt": "text/vtt",
".yaml": "text/yaml",
".yml": "text/yaml",
".mid": "audio/midi",
".midi": "audio/midi",
".mp3": "audio/mp3",
".mp4a": "audio/mp4",
".m4a": "audio/mp4",
".ogg": "audio/ogg",
".spx": "audio/ogg",
".opus": "audio/ogg",
".wav": "audio/wav",
".webm": "audio/webm",
".aac": "audio/x-aac",
".flac": "audio/x-flac",
".mp4": "video/mp4",
".mp4v": "video/mp4",
".mkv": "video/x-matroska",
".mov": "video/quicktime",
".svg": "image/svg+xml",
".avif": "image/avif",
".bmp": "image/bmp",
".gif": "image/gif",
".heic": "image/heic",
".heif": "image/heif",
".jpeg": "image/jpeg",
".jpg": "image/jpeg",
".png": "image/png",
".tiff": "image/tiff",
".psd": "image/vnd.adobe.photoshop",
".ico": "image/vnd.microsoft.icon",
".webp": "image/webp",
".es": "application/ecmascript",
".epub": "application/epub+zip",
".jar": "application/java-archive",
".war": "application/java-archive",
".webmanifest": "application/manifest+json",
".doc": "application/msword",
".dot": "application/msword",
".docx":
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
".dotx":
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
".cjs": "application/node",
".bin": "application/octet-stream",
".pkg": "application/octet-stream",
".dump": "application/octet-stream",
".exe": "application/octet-stream",
".deploy": "application/octet-stream",
".img": "application/octet-stream",
".msi": "application/octet-stream",
".pdf": "application/pdf",
".pgp": "application/pgp-encrypted",
".asc": "application/pgp-signature",
".sig": "application/pgp-signature",
".ai": "application/postscript",
".eps": "application/postscript",
".ps": "application/postscript",
".rdf": "application/rdf+xml",
".rss": "application/rss+xml",
".rtf": "application/rtf",
".apk": "application/vnd.android.package-archive",
".key": "application/vnd.apple.keynote",
".numbers": "application/vnd.apple.keynote",
".pages": "application/vnd.apple.pages",
".geo": "application/vnd.dynageo",
".gdoc": "application/vnd.google-apps.document",
".gslides": "application/vnd.google-apps.presentation",
".gsheet": "application/vnd.google-apps.spreadsheet",
".kml": "application/vnd.google-earth.kml+xml",
".mkz": "application/vnd.google-earth.kmz",
".icc": "application/vnd.iccprofile",
".icm": "application/vnd.iccprofile",
".xls": "application/vnd.ms-excel",
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
".xlm": "application/vnd.ms-excel",
".ppt": "application/vnd.ms-powerpoint",
".pot": "application/vnd.ms-powerpoint",
".pptx":
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
".potx":
"application/vnd.openxmlformats-officedocument.presentationml.template",
".xps": "application/vnd.ms-xpsdocument",
".odc": "application/vnd.oasis.opendocument.chart",
".odb": "application/vnd.oasis.opendocument.database",
".odf": "application/vnd.oasis.opendocument.formula",
".odg": "application/vnd.oasis.opendocument.graphics",
".odp": "application/vnd.oasis.opendocument.presentation",
".ods": "application/vnd.oasis.opendocument.spreadsheet",
".odt": "application/vnd.oasis.opendocument.text",
".rar": "application/vnd.rar",
".unityweb": "application/vnd.unity",
".dmg": "application/x-apple-diskimage",
".bz": "application/x-bzip",
".crx": "application/x-chrome-extension",
".deb": "application/x-debian-package",
".php": "application/x-httpd-php",
".iso": "application/x-iso9660-image",
".sh": "application/x-sh",
".sql": "application/x-sql",
".srt": "application/x-subrip",
".xml": "application/xml",
".zip": "application/zip",
};