diff options
Diffstat (limited to 'src/guff/mime-type.cr')
-rw-r--r-- | src/guff/mime-type.cr | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/guff/mime-type.cr b/src/guff/mime-type.cr new file mode 100644 index 0000000..992521b --- /dev/null +++ b/src/guff/mime-type.cr @@ -0,0 +1,14 @@ +module Guff::MimeType + TYPES = { + ".js": "text/javascript; charset=utf-8", + ".css": "text/css; charset=utf-8", + ".html": "text/html; charset=utf-8", + ".png": "image/png", + ".jpeg": "image/jpeg", + ".jpg": "image/jpeg", + } + + def self.mime_type(path : String) : String + TYPES[File.extname(path)]? || "application/octet-stream" + end +end |