class

TransferMore::MimeSearch

Inherits Reference / Object

Constants

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

new(file : String)
Source

Instance methods

extname
Source
file
Source
get_content_type(default = "application/bin") : String
Source
get_mime_from_extname
Source
get_mime_from_magic_number
Source