Mime type detection in ruby via file extension or file content
Switch branches/tags
Clone or download
Pull request Compare This branch is 8 commits ahead, 39 commits behind minad:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
script
test
.gitignore
.travis.yml
.yardopts
Gemfile
LICENSE
README.md
Rakefile
mimemagic.gemspec

README.md

MimeMagic is a library to detect the mime type of a file by extension or by content. It uses the mime database provided by freedesktop.org (see http://freedesktop.org/wiki/Software/shared-mime-info/).

Build Status Code Climate Gittip donate button Flattr this git repo

Usage

require 'mimemagic'
MimeMagic.by_extension('html').text?
MimeMagic.by_extension('.html').child_of? 'text/plain'
MimeMagic.by_path('filename.txt')
MimeMagic.by_magic(File.open('test.html'))
# etc...

API

http://rdoc.info/github/minad/mimemagic/frames/file/README.md

Tests

bundle install

rake test

Authors

Daniel Mendler