MultiMime
A generic swappable back-end for Mime Type detection
Lots of Ruby libraries utilize Mime Type detection in some form. In order to best support multiple Mime Type detection libraries, multi_mime
is a general-purpose swappable Mime Type detection backend library. eg MultiJson for Mime Types.
Installation
gem 'multi_mime', '~> 0.0.3'
require 'multi_mime'
Features / Usage Examples
MultiMime.type_for('text/html') # 'text/html'
# alias :by_type
MultiMime.type_for_extension('.html') # 'text/html'
# alias :by_extension
MultiMime.type_for_path('/usr/local/foo/bar/foo.html') # 'text/html'
# alias :by_path
MultiMime.type_for_file( File.open('foo.html', 'w') ) # 'text/html'
# alias :by_file
Badges
Supported Mime Engines
- MIME::Types
- MagicMime
- Rails (ActionDispatch::Http::Mime)
- Rack (Rack::Mime)
Supported Ruby Versions
This library aims to support and is tested against the following Ruby implementations:
Credits
Inspiration:
Cribbed: