Monday, December 22nd, 2008

mimeparse: now in JavaScript

Category: JavaScript


  1. Mimeparse.bestMatch(['application/xbel+xml', 'text/xml'], 'text/*;q=0.5,*/*; q=0.1');

The above code is from a JavaScript port of Joe Gregorio’s mimeparse library that “provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification RFC 2616 for a complete explanation.”

Using it you can do things such as:

I have a feeling that one day we will look around and realise that we actually have a JavaScript library after all, and that server side JavaScript can do the trick :)

Posted by Dion Almaer at 5:18 am

2.4 rating from 9 votes


Comments feed TrackBack URI

I’m not really sure what the applicable use of this on the client layer would be, after all to determine the mimetype of a file you’d likely be feeding that from the server side… Or am I missing something?

Comment by oopstudios — December 22, 2008

You are missing something. This is for rich internet applications.

Comment by jaysmith — December 23, 2008

Leave a comment

You must be logged in to post a comment.