class TransferMore::MimeSearch
Defined in:
transfer_more/lib/mime_search.cr
Constant Summary
-
EXT =
{"image" => ["png", "jpeg", "gif", "tiff"] of ::String, "text" => "css html csv plain txt patch md", "application" => ["javascript", "json", "pdf", "xml", "zip"] of ::String, "audio" => ["mpeg", "ogg"] of ::String, "video" => ["mpeg", "mp4", "webm"] of ::String}
-
EXT_TRANSFORM =
{["jpg", "jpe"] of ::String => "jpeg", ["txt", "text", "md"] of ::String => "plain"}
-
MAGIC_NUMBERS =
{[255, 216] => "image/jpg", [71, 73, 70, 56, 57, 97] => "image/gif", [71, 73, 70, 56, 55, 97] => "image/gif", [137, 80, 78, 71, 13, 10, 26, 10] => "image/png", [35, 33] => "text/plain", [37, 80, 68, 70] => "application/pdf", [255, 251] => "audio/mpeg", [73, 68, 51] => "audio/mpeg", [79, 103, 103, 83] => "audio/ogg", [26, 69, 223, 163] => "video/x-matroska", [82, 73, 70, 70] => "video/avi"}
Constructors
Instance Method Summary
Constructor Detail
def self.
new(file : String)
#
Instance Method Detail
def
get_content_type(default =
"application/bin") : String
#
def
get_mime_from_extname : String | Nil
#
def
get_mime_from_magic_number : String | Nil
#