mime-types.scm 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. (define-module (mime-types)
  2. #:export (file-extension-mime-types))
  3. (use-modules
  4. ((srfi srfi-69) #:prefix srfi-69:))
  5. ;; The following hash-table contains MIME types for common file types.
  6. ;; See also:
  7. ;; https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
  8. ;; https://www.iana.org/assignments/media-types/media-types.xhtml
  9. ;; This list of MIME types is not comprehensive. It is only a personal opinion
  10. ;; of what might be needed.
  11. (define file-extension-mime-types
  12. (srfi-69:alist->hash-table
  13. '(("bz" . application/x-bzip)
  14. ("bz2" . application/x-bzip2)
  15. ("css" . text/css)
  16. ("csv" . text/csv)
  17. ("gz" . application/gzip)
  18. ("gif" . image/gif)
  19. ("htm" . text/html)
  20. ("html" . text/html)
  21. ("jpg" . image/jpeg)
  22. ("jpeg" . image/jpeg)
  23. ("js" . text/javascript)
  24. ("json" . application/json)
  25. ("mjs" . text/javascript)
  26. ("odp" . application/vnd.oasis.opendocument.presentation)
  27. ("ods" . application/vnd.oasis.opendocument.spreadsheet)
  28. ("odt" . application/vnd.oasis.opendocument.text)
  29. ("oga" . audio/ogg)
  30. ("ogx" . application/ogg)
  31. ("png" . image/png)
  32. ("pdf" . application/pdf)
  33. ("sh" . application/x-sh)
  34. ("svg" . image/svg+xml)
  35. ("tar" . application/x-tar)
  36. ("tif" . image/tiff)
  37. ("tiff" . image/tiff)
  38. ("ttf" . font/ttf)
  39. ("txt" . text/plain)
  40. ("wav" . audio/wav)
  41. ("weba" . audio/webm)
  42. ("webm" . video/webm)
  43. ("webp" . image/webp)
  44. ("xhtml" . application/xhtml+xml)
  45. ("xul" . application/vnd.mozilla.xul+xml)
  46. ("zip" . application/zip)
  47. ("7z" . application/x-7z-compressed))))