deno.land / x / servest@v1.3.4 / media_types.ts

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
// Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license.const kBasicContentTypes: [string, string][] = [ [".html", "text/html"], [".md", "text/markdown"], [".txt", "text/plain"], [".css", "text/css"], [".jpg", "image/jpeg"], [".jpeg", "image/jpeg"], [".png", "image/png"], [".gif", "image/gif"], [".pdf", "application/pdf"], [".zip", "application/zip"], [".svg", "image/svg+xml"], [".webp", "image/webp"], [".js", "application/javascript"], [".mjs", "application/javascript"], [".jsx", "application/javascript"], [".ts", "application/javascript"], [".tsx", "application/javascript"], [".json", "application/json"],];
const typeByExt: Map<string, string> = kBasicContentTypes.reduce( (map, [e, t]) => map.set(e, t), new Map(),);const extByType: Map<string, string> = kBasicContentTypes.reduce( (map, [e, t]) => map.set(t, e), new Map(),);
export function contentTypeByExt(extWithDot: string): string | undefined { return typeByExt.get(extWithDot);}
export function extByContentType(contentType: string): string | undefined { return extByType.get(contentType);}
servest

Version Info

Tagged at
2 years ago