[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Determine mime type of a file
- From: Marco <netuse@...>
- Date: Mon, 2 May 2011 13:02:12 +0200
On 2011-05-02 Adrian Perez <aperez@igalia.com> wrote:
> > On Mon, May 02, 2011 at 10:55:23AM +0200, Marco wrote:
> >
> > > How can I determine the mime type of a file (like
> > the unix > command “file -i <some_file>”)? > Well, on
> > my Ubuntu system it's this easy:
> >
> > > function mime_type(a) return io.popen('file -i
> > > '..a):read() end
> >
> > Unfortunately io.popen "is system dependent and is not
> > available on all platforms."
>
> Another thing that could be done is binding libmagic
> [1], which is what the “file” command uses internally.
Thanks for the pointer. Looks promising.
Marco