12345678910111213141516171819202122232425262728293031323334353637383940 |
- var pathlib = require("path");
-
- module.exports = mimetype;
-
- function mimetype(path) {
- var ext = pathlib.extname(path)
- .substring(1)
- .toLowerCase();
-
- switch (ext) {
-
- case "html":
- case "xml":
- return "text/"+ext;
-
- case "png":
- case "jpg":
- case "jpeg":
- case "gif":
- return "image/"+ext;
-
- case "svg":
- return "image/svg+xml";
-
- case "mov":
- case "mp4":
- case "ogv":
- case "webm":
- return "video/"+ext;
-
- case "mp3":
- case "ogg":
- case "flac":
- case "m4a":
- return "audio/"+ext;
-
- default:
- return "application/octet-stream";
- }
- }
|