lua-users home
lua-l archive

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


On Mon, May 2, 2011 at 11:32 AM, Marco <netuse@lavabit.com> wrote:
> What do you mean by catalog?  A file extension - mime type
> mapping?

That is exactly what the Gnome MIME XML files provide.

>That would  quickly  break when  a  file has  no
> extension (file -i is not confused by this).

Well, if we can't find it, then we have to give some default, like
text/plain or application/binary.  'file' is a very clever command ;)

A portable solution would start with a list of the common registered
MIME types, and encode it as a Lua table.  You would probably find
such tables in a number of Lua web frameworks, but making such a table
should be straightforward, either lots of typing or an opportunity to
write a fun script ;)

steve d.