file server content type headers
This commit is contained in:
26
util/contentType.ts
Executable file
26
util/contentType.ts
Executable file
@@ -0,0 +1,26 @@
|
||||
export function getContentTypeByExtension(extension: string) {
|
||||
switch (extension) {
|
||||
case "html":
|
||||
case "htm":
|
||||
return "text/html";
|
||||
case "css":
|
||||
return "text/css";
|
||||
case "js":
|
||||
return "text/javascript";
|
||||
case "json":
|
||||
return "application/json";
|
||||
case "png":
|
||||
return "image/png";
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
return "image/jpeg";
|
||||
case "gif":
|
||||
return "image/gif";
|
||||
case "svg":
|
||||
return "image/svg+xml";
|
||||
case "txt":
|
||||
return "text/plain";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user