whatwg / mimesniff

MIME Sniffing Standard

Home Page:https://mimesniff.spec.whatwg.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIME type API: extensions

annevk opened this issue · comments

I'm sometimes reminded by Yehuda that exposing basic checks and constants the browser has is useful. So if #43 gets implemented we should consider exposing "XML MIME type", "JSON MIME type", "JavaScript MIME type", et al.

Given that sometimes this involves an "ends with" match on the subtype it doesn't seem like just exposing the array of MIME types is the way to go.

This leaves us with either static or instance methods. I don't have a strong opinion either way. If someone can find compelling precedents that'd be most welcome.

(The main reason I don't want to do this straight away is that I'm not sure the MIME type groups have really solidified yet.)

I'd generally come down in favor off leaving this bit to userland. Yes, it can be useful but I don't see it as something critical for the base standard API.

The main reason is that browsers all have these lists/checks internally already and are therefore begging to be exposed in some manner. I'm happy to hold off on this though until all browsers and Node.js have shipped the basic API and we got some experience with that. No need to rush things especially given none of this has been exposed thus far (or cleaned up).