-
Notifications
You must be signed in to change notification settings - Fork 271
Expand file tree
/
Copy pathnormalizeMimeType.ts
More file actions
46 lines (45 loc) · 2.34 KB
/
normalizeMimeType.ts
File metadata and controls
46 lines (45 loc) · 2.34 KB
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
function normalizeMimeType (mime: string) {
switch (mime) {
case "audio/x-wav": return "audio/wav";
case "audio/vnd.wave": return "audio/wav";
case "application/ogg": return "audio/ogg";
case "application/x-gzip": return "application/gzip";
case "application/x-zstd": return "application/zstd";
case "image/x-icns": return "image/icns";
case "image/x-icon": return "image/vnd.microsoft.icon";
case "image/vtf": return "image/x-vtf";
case "image/aseprite": return "image/x-aseprite";
case "application/x-aseprite": return "image/x-aseprite";
case "image/qoi": return "image/x-qoi";
case "video/bink": return "video/vnd.radgamettools.bink";
case "video/binka": return "audio/vnd.radgamettools.bink";
case "video/brstm": return "audio/brstm";
case "audio/x-quicktime": return "video/quicktime";
case "audio/x-flo": return "audio/flo";
case "application/x-flo": return "audio/flo";
case "application/x-lharc": return "application/x-lzh-compressed";
case "application/lha": return "application/x-lzh-compressed";
case "application/x-lha": return "application/x-lzh-compressed";
case "application/x-lzh": return "application/x-lzh-compressed";
case "application/x-mtga": return "application/vnd.sqlite3";
case "application/x-itunes-itdb": return "application/vnd.sqlite3"; // Not required, but just in case
case "audio/x-flac": return "audio/flac";
case "application/font-sfnt": return "font/ttf";
case "application/x-font-ttf": return "font/ttf"; // both TTF & OTF
case "application/x-font-opentype": return "font/otf";
case "application/font-woff": return "font/woff";
case "application/x-font-woff": return "font/woff";
case "application/font-woff2": return "font/woff2";
case "application/x-font-woff2": return "font/woff2";
case "application/musicxml": return "application/vnd.recordare.musicxml+xml";
case "application/musicxml+xml": return "application/vnd.recordare.musicxml+xml";
case "text/mathml": return "application/mathml+xml";
case "text/json": return "application/json";
case "text/x-json": return "application/json";
case "text/json5": return "application/json5";
case "application/x-json5": return "application/json5";
case "video/x-ms-wmv": return "video/x-ms-asf";
}
return mime;
}
export default normalizeMimeType;