lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hello, everyone!

I have just finished the first version of `mimetypes`, a Lua library that guesses MIME types for filenames. For example:

    > mimetypes = require 'mimetypes'
    > = mimetypes.guess "index.html"
    > = mimetypes.guess "mimetypes.lua"
    > = mimetypes.guess "report.docx"
    > = mimetypes.guess "README"
    > = mimetypes.guess "notreal.extension"

You can also have it guess from your own database of MIME types. The built-in database was mostly obtained from Python 2.7.1's `` module, as well as Xavante's MIME types file and Rack::Mime from Rack.

Its home page is at <>, and you can download it from the "Downloads" tab there. (If I got a MIME type wrong, file an issue on the site so as not to flood the list.) All the documentation is in the README file, and there is also a small test file you can run.

The rockspec hasn't been published yet, but it should be soon, and once it is you will be able to run `luarocks install mimetypes` to install it.
Thanks, Matthew Frazier