Module: Fastlane::Mime

Defined in:
lib/fastlane/plugin/polidea/helper/mime.rb

Class Method Summary collapse

Class Method Details

.content_type_for_file(file) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/polidea/helper/mime.rb', line 3

def self.content_type_for_file(file)
  file_extension = File.extname(file)
  extensions_to_type = {
    ".html" => "text/html",
    ".png"  => "image/png",
    ".jpg"  => "image/jpeg",
    ".gif"  => "image/gif",
    ".svg"  => "image/svg+xml",
    ".log"  => "text/plain",
    ".css"  => "text/css",
    ".js"   => "application/javascript"
  }
  if extensions_to_type[file_extension].nil?
    "application/octet-stream"
  else
    extensions_to_type[file_extension]
  end
end