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. WWW: https://github.com/mimemagicrb/mimemagic