shared-mime-info¶ ↑
shared-mime-info is a pure Ruby library for accessing the MIME info database provided by Freedesktop on Standards/shared-mime-info-spec.
Project¶ ↑
The rubyforge project : rubyforge.org/projects/shared-mime
The github repository: github.com/hanklords/shared-mime-info/tree/master
Usage¶ ↑
require 'shared-mime-info' MIME.check 'sample.jpg' # => #<MIME::Type ..., @type="image/jpeg"> MIME['image/jpeg'].match_filename? 'sample.jpg' # => true
Notes¶ ↑
-
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