I found this gem which shells out 

https://github.com/mattetti/mimetype-fu/blob/master/lib/mimetype_fu.rb#L20

The major disadvantage to this though is it has to create a tempfile for the StringIO (which we do anyway but not until it has already passed our checks)

I'll leave this decision up to you if we want to proceed.