MIME-Type-FileName reviews


RSS | Module Info | Add a review of MIME-Type-FileName

MIME-Type-FileName (1.0)

The module is very simple and minimal. It consists of a small piece of code which is run when the module is used, which maps a hash of file endings to mime types, a routine called "guess" which strips the file extension and returns the equivalent mime type, or "application/octet-stream" if no extension is found, and a big block of data of extension to file name.

Unfortunately it overwrites its own values, so .jpeg turns into image/pjpeg, as reported here:


The provenance of the list of mime types is also unknown, the author doesn't mention where it comes from, but there are some definitely wrong ones like "application/x-javascript" which should be "application/javascript". The IANI list is online and available in text form for anyone to copy here:


so that kind of issue shouldn't have arised.

I wonder why the author created this module. I remember using MIME::Types back in 2008 or so, and the first version of this one dates from 2012. Good old MIME::Types gets 13/16 file names to correct mime types in my test, but this only gets 8/16. What was the original motivation for making another file extension to mime type module? It's not documented.

Anyway it is nice and simple, and self-contained, but unfortunately not very accurate.

For a comparison with similar modules, please see my page at www.lemoda.net/perl/find-type-of-file/