jshttp / mime-types

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

Type inconsistencies between node-mime, MDN, and mime-db #36

Open broofa opened 7 years ago

broofa commented 7 years ago

Related to https://github.com/broofa/node-mime/issues/162

The v2 unit test I have in node-uuid turned up some mappings that seem "questionable" in mime-types. I believe these are a result of the more nuanced approach to extension resolution I have in v2 that prefers "standard" types over vendor (or in the "x-" cases, experimental) types.

Again, this isn't breaking anything for me, but may be worth addressing.

AssertionError: Type inconsistencies: [
  "mime-types[exe] = application/x-msdos-program, node-uuid[exe] = application/octet-stream",
  "mime-types[dll] = application/x-msdownload, node-uuid[dll] = application/octet-stream",
  "mime-types[deb] = application/x-debian-package, node-uuid[deb] = application/octet-stream",
  "mime-types[dmg] = application/x-apple-diskimage, node-uuid[dmg] = application/octet-stream",
  "mime-types[iso] = application/x-iso9660-image, node-uuid[iso] = application/octet-stream",
  "mime-types[msi] = application/x-msdownload, node-uuid[msi] = application/octet-stream",
  "mime-types[wav] = audio/wave, node-uuid[wav] = audio/wav"
dougwilson commented 7 years ago

It looks like all but one can at least be attributed to the resolution I implemented which has the rule of "any type is better than application/octet-stream". I'm wondering why application/octet-stream may be more preferable to other types.

The other is audio/wav vs audio/wave. Not sure what to make of that off-hand.

broofa commented 7 years ago

If you look at the scores in https://github.com/broofa/node-mime/issues/162, it shows (once you know how to read them)... the octet-stream types are 1) on the "standard" facet (no x- prefix), and 2) sourced from IANA. Whereas the x- ones are 1) on the experimental facet, and 2) sourced form nginx. So.. octet-stream wins 2x.

audio/wav scores identically (both standard facet, both from apache)... wav only wins by virtue of being shorter. Which is rather arbitrary, but if you google around there doesn't appear to be any real consensus on this so... :-/