jshttp / mime-types

The ultimate javascript content-type utility.
MIT License
1.33k stars 129 forks source link

Multiple Mime-Types for an extension #23

Open jstans opened 8 years ago

jstans commented 8 years ago

This relates to: koajs/koa#617.

As an extension can correspond to multiple mime-types, wouldn't it be correct to return an array of all matches and let libraries handle that?

Perhaps a .lookupAll() which strictly returns an array to avoid breaking existing code or over-complicating something which not everyone will want to make use of.

thihara commented 8 years ago

@dougwilson Anyone working on this?

dougwilson commented 8 years ago

HI @thihara nope. I see you made a PR, so awesome!

rijnhard commented 7 years ago

This still has value, I just ran into it now. I see the pr for allExtensions but not for lookupAll (all mime types from a single extension) Makes it kind of difficult to check that the binary is what you are expecting from the extension or content-type headers.

I'm going to log an issue on our tracking system, if it doesn't move the odds are I will do it.

pseudoramble commented 7 years ago

I took a crack at this today and have a PR open for it. Hoping it's a good starting point to discuss more!