Module: Bini::FileMagic
Overview
A collection of helpers related to file management.
Instance Method Summary collapse
-
#mime_type(file) ⇒ String, Nil
Call the system app ‘file’ to check mimetype.
Instance Method Details
#mime_type(file) ⇒ String, Nil
Call the system app ‘file’ to check mimetype.
10 11 12 13 |
# File 'lib/bini/filemagic.rb', line 10 def mime_type(file) return `file -bk --mime-type "#{file}"`.chomp! if File.exist? file return nil end |