[plt-scheme] Guessing the file type?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sun Jul 26 14:32:41 EDT 2009

make-path->mime-type takes a path to the MIME database (such as
/private/etc/apache2/mime.types on OS X) returns a procedure than when
given a path will return the mime type. It is basically building a
cache to get mime types fast.

Jay

On Sun, Jul 26, 2009 at 9:40 AM, Amit Saha<lists.amitsaha at gmail.com> wrote:
> Amit Saha wrote:
>>
>> Jay McCarthy wrote:
>>>
>>> On Unix/OS X there is a program called 'file' that works pretty well.
>>
>> Yep. I was looking for a plt-scheme interface..
>>
>>>
>>> Also, if you use the mime type library in the PLT Web server, it uses
>>> the system database of file extensions to return a mime type.
>>
>> Yeah..I came across this. However, I thought of consulting the list to
>> enquire if there was another way..
>
>
> I have used 'make-path->mime-type' which gives back a procedure for the
> relevant MIME type. For eg:
>
>> (make-path->mime-type (build-path "/home/r00t/Music/" "m.mp3"))
> #<procedure:...rivate/mime-types.ss:9:44>
>
>
> Not sure, how can I obtain the MIME type now? I can see: make-get-mime-type
> : path? -> path? -> bytes? in private/mime-types.ss. Again not sure, how it
> can be used..
>
> Please suggest.
>
> Best,
> Amit
> --
> email: amitsaha.in at gmail.com
> Journal: http://amitksaha.wordpress.com
> µ-blog: http://twitter.com/amitsaha
> IRC: cornucopic on #scheme, #lisp, #math, #linux
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.