Pictures!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mimetype.js 544B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. var pathlib = require("path");
  2. module.exports = mimetype;
  3. function mimetype(path) {
  4. var ext = pathlib.extname(path)
  5. .substring(1)
  6. .toLowerCase();
  7. switch (ext) {
  8. case "html":
  9. case "xml":
  10. return "text/"+ext;
  11. case "png":
  12. case "jpg":
  13. case "jpeg":
  14. case "gif":
  15. return "image/"+ext;
  16. case "svg":
  17. return "image/svg+xml";
  18. case "mov":
  19. case "mp4":
  20. case "ogv":
  21. case "webm":
  22. return "video/"+ext;
  23. case "mp3":
  24. case "ogg":
  25. case "flac":
  26. case "m4a":
  27. return "audio/"+ext;
  28. default:
  29. return "application/octet-stream";
  30. }
  31. }