aboutsummaryrefslogtreecommitdiff
path: root/src/guff/mime-type.cr
blob: 992521b1499e5bdeb01b6b73ec81692d1dd9aa6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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