Skip to content

Library to guess the MIME type of a file with both filename lookup and magic file detection

License

Notifications You must be signed in to change notification settings

orgads/shared-mime-info

 
 

Repository files navigation

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

About

Library to guess the MIME type of a file with both filename lookup and magic file detection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 92.5%
  • Other 7.5%