shared-mime-info is a pure Ruby library for accessing the MIME info database provided by Freedesktop on Standards/shared-mime-info-spec.
The rubyforge project : rubyforge.org/projects/shared-mime
The github repository: github.com/hanklords/shared-mime-info/tree/master
require 'shared-mime-info' MIME.check 'sample.jpg' # => #<MIME::Type ..., @type="image/jpeg"> MIME['image/jpeg'].match_filename? 'sample.jpg' # => true
-
Ensure that shared-mime-info is installed on the system:
> brew install shared-mime-info
-
You may need to update the mime database first:
> update-mime-database