Search code examples
rubymime-types

Get mimetype from filename


MIME::Types.type_for(filename)

What gem do I need to install, and what file do I need to require to use that?


Solution

  • gem install mime-types and require 'mime/types'