Coder Social home page Coder Social logo

browser-mime's Introduction

browser-mime Build Status

MIME types that can be parsed/rendered in most browsers. The list is automatically generated from mime-db. Manual types and extension information is also included in src/initial-db.json.

To rebuild the JS library in dist/:

npm build

To regenerate the database:

npm run build-db

This will reproduce browser-mime-db.json by attempting to load an empty file of every type in mime-db, and keep track of which ones Chrome was able to download and use vs. prompting the user with a Download popup.

The mime-types project is included as a squashed subtree in mime-types/. To update the subtree code use npm run update-mime-types.

API

The API is identical too, and shares the same code as, mime-types. From their README:

var mime = require('mime-types')

All functions return false if input is invalid or not found.

mime.lookup(path)

Lookup the content-type associated with a file.

mime.lookup('json')             // 'application/json'
mime.lookup('.md')              // 'text/markdown'
mime.lookup('file.html')        // 'text/html'
mime.lookup('folder/file.js')   // 'application/javascript'
mime.lookup('folder/.htaccess') // false

mime.lookup('cats') // false

mime.contentType(type)

Create a full content-type header given a content-type or extension. When given an extension, mime.lookup is used to get the matching content-type, otherwise the given content-type is used. Then if the content-type does not already have a charset parameter, mime.charset is used to get the default charset and add to the returned content-type.

mime.contentType('markdown')  // 'text/x-markdown; charset=utf-8'
mime.contentType('file.json') // 'application/json; charset=utf-8'
mime.contentType('text/html') // 'text/html; charset=utf-8'
mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1'

// from a full path
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'

mime.extension(type)

Get the default extension for a content-type.

mime.extension('application/octet-stream') // 'bin'

mime.charset(type)

Lookup the implied default charset of a content-type.

mime.charset('text/markdown') // 'UTF-8'

var type = mime.types[extension]

A map of content-types by extension.

[extensions...] = mime.extensions[type]

A map of extensions by content-type.

browser-mime's People

Contributors

bobbyg603 avatar humphd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

browser-mime's Issues

Get all tests passing

I've added tests based on what the various browser engines use internally. There are still 146 tests that fail.

  304 passing (96ms)
  146 failing

  1) Chromium MIME Types
       Should support Chromium's 'video/webm':
     AssertionError [ERR_ASSERTION]: false === 'video/webm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  2) Chromium MIME Types
       Should support Chromium's 'application/wasm':
     AssertionError [ERR_ASSERTION]: false === 'application/wasm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  3) Chromium MIME Types
       Should support Chromium's 'application/x-chrome-extension':
     AssertionError [ERR_ASSERTION]: false === 'application/x-chrome-extension'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  4) Chromium MIME Types
       Should support Chromium's 'application/xhtml+xml':
     AssertionError [ERR_ASSERTION]: false === 'application/xhtml+xml'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  5) Chromium MIME Types
       Should support Chromium's 'audio/flac':
     AssertionError [ERR_ASSERTION]: false === 'audio/flac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  6) Chromium MIME Types
       Should support Chromium's 'audio/mp3':
     AssertionError [ERR_ASSERTION]: false === 'audio/mp3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  7) Chromium MIME Types
       Should support Chromium's 'audio/ogg':
     AssertionError [ERR_ASSERTION]: false === 'audio/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  8) Chromium MIME Types
       Should support Chromium's 'audio/wav':
     AssertionError [ERR_ASSERTION]: false === 'audio/wav'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  9) Chromium MIME Types
       Should support Chromium's 'audio/webm':
     AssertionError [ERR_ASSERTION]: false === 'audio/webm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  10) Chromium MIME Types
       Should support Chromium's 'audio/x-m4a':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-m4a'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  11) Chromium MIME Types
       Should support Chromium's 'image/apng':

      AssertionError [ERR_ASSERTION]: 'image/png' === 'image/apng'
      + expected - actual

      -image/png
      +image/apng

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  12) Chromium MIME Types
       Should support Chromium's 'multipart/related':
     AssertionError [ERR_ASSERTION]: false === 'multipart/related'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  13) Chromium MIME Types
       Should support Chromium's 'text/html':
     AssertionError [ERR_ASSERTION]: false === 'text/html'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  14) Chromium MIME Types
       Should support Chromium's 'text/javascript':

      AssertionError [ERR_ASSERTION]: 'application/javascript' === 'text/javascript'
      + expected - actual

      -application/javascript
      +text/javascript

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  15) Chromium MIME Types
       Should support Chromium's 'text/xml':

      AssertionError [ERR_ASSERTION]: 'application/xml' === 'text/xml'
      + expected - actual

      -application/xml
      +text/xml

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  16) Chromium MIME Types
       Should support Chromium's 'video/mp4':
     AssertionError [ERR_ASSERTION]: false === 'video/mp4'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  17) Chromium MIME Types
       Should support Chromium's 'video/ogg':
     AssertionError [ERR_ASSERTION]: false === 'video/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  18) Chromium MIME Types
       Should support Chromium's 'image/x-icon':

      AssertionError [ERR_ASSERTION]: 'image/vnd.microsoft.icon' === 'image/x-icon'
      + expected - actual

      -image/vnd.microsoft.icon
      +image/x-icon

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  19) Chromium MIME Types
       Should support Chromium's 'application/epub+zip':
     AssertionError [ERR_ASSERTION]: false === 'application/epub+zip'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  20) Chromium MIME Types
       Should support Chromium's 'application/font-woff':
     AssertionError [ERR_ASSERTION]: false === 'application/font-woff'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  21) Chromium MIME Types
       Should support Chromium's 'application/gzip':
     AssertionError [ERR_ASSERTION]: false === 'application/gzip'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  22) Chromium MIME Types
       Should support Chromium's 'application/octet-stream':
     AssertionError [ERR_ASSERTION]: false === 'application/octet-stream'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  23) Chromium MIME Types
       Should support Chromium's 'application/pdf':
     AssertionError [ERR_ASSERTION]: false === 'application/pdf'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  24) Chromium MIME Types
       Should support Chromium's 'application/pkcs7-mime':
     AssertionError [ERR_ASSERTION]: false === 'application/pkcs7-mime'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  25) Chromium MIME Types
       Should support Chromium's 'application/pkcs7-signature':
     AssertionError [ERR_ASSERTION]: false === 'application/pkcs7-signature'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  26) Chromium MIME Types
       Should support Chromium's 'application/postscript':
     AssertionError [ERR_ASSERTION]: false === 'application/postscript'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  27) Chromium MIME Types
       Should support Chromium's 'application/rdf+xml':
     AssertionError [ERR_ASSERTION]: false === 'application/rdf+xml'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  28) Chromium MIME Types
       Should support Chromium's 'application/vnd.android.package-archive':
     AssertionError [ERR_ASSERTION]: false === 'application/vnd.android.package-archive'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  29) Chromium MIME Types
       Should support Chromium's 'application/vnd.mozilla.xul+xml':
     AssertionError [ERR_ASSERTION]: false === 'application/vnd.mozilla.xul+xml'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  30) Chromium MIME Types
       Should support Chromium's 'application/x-gzip':
     AssertionError [ERR_ASSERTION]: false === 'application/x-gzip'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  31) Chromium MIME Types
       Should support Chromium's 'application/x-mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'application/x-mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  32) Chromium MIME Types
       Should support Chromium's 'application/x-shockwave-flash':
     AssertionError [ERR_ASSERTION]: false === 'application/x-shockwave-flash'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  33) Chromium MIME Types
       Should support Chromium's 'application/x-tar':
     AssertionError [ERR_ASSERTION]: false === 'application/x-tar'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  34) Chromium MIME Types
       Should support Chromium's 'application/zip':
     AssertionError [ERR_ASSERTION]: false === 'application/zip'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  35) Chromium MIME Types
       Should support Chromium's 'audio/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  36) Chromium MIME Types
       Should support Chromium's 'audio/webm':
     AssertionError [ERR_ASSERTION]: false === 'audio/webm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  37) Chromium MIME Types
       Should support Chromium's 'image/jpeg':
     AssertionError [ERR_ASSERTION]: false === 'image/jpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  38) Chromium MIME Types
       Should support Chromium's 'image/tiff':
     AssertionError [ERR_ASSERTION]: false === 'image/tiff'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  39) Chromium MIME Types
       Should support Chromium's 'image/x-png':

      AssertionError [ERR_ASSERTION]: 'image/png' === 'image/x-png'
      + expected - actual

      -image/png
      +image/x-png

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  40) Chromium MIME Types
       Should support Chromium's 'message/rfc822':
     AssertionError [ERR_ASSERTION]: false === 'message/rfc822'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  41) Chromium MIME Types
       Should support Chromium's 'text/calendar':
     AssertionError [ERR_ASSERTION]: false === 'text/calendar'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  42) Chromium MIME Types
       Should support Chromium's 'text/html':
     AssertionError [ERR_ASSERTION]: false === 'text/html'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  43) Chromium MIME Types
       Should support Chromium's 'text/x-sh':
     AssertionError [ERR_ASSERTION]: false === 'text/x-sh'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  44) Chromium MIME Types
       Should support Chromium's 'text/xml':

      AssertionError [ERR_ASSERTION]: 'application/xml' === 'text/xml'
      + expected - actual

      -application/xml
      +text/xml

      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  45) Chromium MIME Types
       Should support Chromium's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  46) Firefox MIME Types
       Should support Firefox's 'x-sun-attachment':

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true

      at Context.it (test/test.js:31:17)

  47) WebKit MIME Types
       Should support WebKit's 'application/ogg':
     AssertionError [ERR_ASSERTION]: false === 'application/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  48) WebKit MIME Types
       Should support WebKit's 'audio/ogg':
     AssertionError [ERR_ASSERTION]: false === 'audio/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  49) WebKit MIME Types
       Should support WebKit's 'audio/ogg':
     AssertionError [ERR_ASSERTION]: false === 'audio/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  50) WebKit MIME Types
       Should support WebKit's 'video/ogg':
     AssertionError [ERR_ASSERTION]: false === 'video/ogg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  51) WebKit MIME Types
       Should support WebKit's 'application/annodex':
     AssertionError [ERR_ASSERTION]: false === 'application/annodex'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  52) WebKit MIME Types
       Should support WebKit's 'audio/annodex':
     AssertionError [ERR_ASSERTION]: false === 'audio/annodex'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  53) WebKit MIME Types
       Should support WebKit's 'video/annodex':
     AssertionError [ERR_ASSERTION]: false === 'video/annodex'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  54) WebKit MIME Types
       Should support WebKit's 'audio/speex':
     AssertionError [ERR_ASSERTION]: false === 'audio/speex'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  55) WebKit MIME Types
       Should support WebKit's 'video/webm':
     AssertionError [ERR_ASSERTION]: false === 'video/webm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  56) WebKit MIME Types
       Should support WebKit's 'audio/webm':
     AssertionError [ERR_ASSERTION]: false === 'audio/webm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  57) WebKit MIME Types
       Should support WebKit's 'audio/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  58) WebKit MIME Types
       Should support WebKit's 'audio/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  59) WebKit MIME Types
       Should support WebKit's 'audio/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  60) WebKit MIME Types
       Should support WebKit's 'audio/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  61) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  62) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  63) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  64) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  65) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  66) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  67) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  68) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  69) WebKit MIME Types
       Should support WebKit's 'video/mpeg':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  70) WebKit MIME Types
       Should support WebKit's 'application/vnd.apple.mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'application/vnd.apple.mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  71) WebKit MIME Types
       Should support WebKit's 'application/mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'application/mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  72) WebKit MIME Types
       Should support WebKit's 'application/x-mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'application/x-mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  73) WebKit MIME Types
       Should support WebKit's 'audio/mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  74) WebKit MIME Types
       Should support WebKit's 'audio/x-mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  75) WebKit MIME Types
       Should support WebKit's 'audio/mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  76) WebKit MIME Types
       Should support WebKit's 'audio/x-mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  77) WebKit MIME Types
       Should support WebKit's 'video/x-m4v':
     AssertionError [ERR_ASSERTION]: false === 'video/x-m4v'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  78) WebKit MIME Types
       Should support WebKit's 'audio/x-m4a':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-m4a'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  79) WebKit MIME Types
       Should support WebKit's 'audio/x-m4b':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-m4b'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  80) WebKit MIME Types
       Should support WebKit's 'audio/x-m4p':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-m4p'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  81) WebKit MIME Types
       Should support WebKit's 'audio/mp4':
     AssertionError [ERR_ASSERTION]: false === 'audio/mp4'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  82) WebKit MIME Types
       Should support WebKit's 'audio/mp3':
     AssertionError [ERR_ASSERTION]: false === 'audio/mp3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  83) WebKit MIME Types
       Should support WebKit's 'audio/x-mp3':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mp3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  84) WebKit MIME Types
       Should support WebKit's 'audio/x-mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  85) WebKit MIME Types
       Should support WebKit's 'video/x-mpeg2':
     AssertionError [ERR_ASSERTION]: false === 'video/x-mpeg2'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  86) WebKit MIME Types
       Should support WebKit's 'video/mpeg2':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg2'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  87) WebKit MIME Types
       Should support WebKit's 'video/mpeg2':
     AssertionError [ERR_ASSERTION]: false === 'video/mpeg2'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  88) WebKit MIME Types
       Should support WebKit's 'video/m2ts':
     AssertionError [ERR_ASSERTION]: false === 'video/m2ts'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  89) WebKit MIME Types
       Should support WebKit's 'video/x-m2ts':
     AssertionError [ERR_ASSERTION]: false === 'video/x-m2ts'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  90) WebKit MIME Types
       Should support WebKit's 'video/x-m2ts':
     AssertionError [ERR_ASSERTION]: false === 'video/x-m2ts'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  91) WebKit MIME Types
       Should support WebKit's 'audio/3gpp':
     AssertionError [ERR_ASSERTION]: false === 'audio/3gpp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  92) WebKit MIME Types
       Should support WebKit's 'audio/3gpp2':
     AssertionError [ERR_ASSERTION]: false === 'audio/3gpp2'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  93) WebKit MIME Types
       Should support WebKit's 'application/x-mpeg':
     AssertionError [ERR_ASSERTION]: false === 'application/x-mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  94) WebKit MIME Types
       Should support WebKit's 'audio/aac':
     AssertionError [ERR_ASSERTION]: false === 'audio/aac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  95) WebKit MIME Types
       Should support WebKit's 'audio/aac':
     AssertionError [ERR_ASSERTION]: false === 'audio/aac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  96) WebKit MIME Types
       Should support WebKit's 'audio/x-aac':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-aac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  97) WebKit MIME Types
       Should support WebKit's 'audio/x-caf':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-caf'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  98) WebKit MIME Types
       Should support WebKit's 'audio/x-gsm':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-gsm'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  99) WebKit MIME Types
       Should support WebKit's 'audio/x-wav':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-wav'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  100) WebKit MIME Types
       Should support WebKit's 'audio/vnd.wave':
     AssertionError [ERR_ASSERTION]: false === 'audio/vnd.wave'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  101) WebKit MIME Types
       Should support WebKit's 'image/x-ms-bmp':
     AssertionError [ERR_ASSERTION]: false === 'image/x-ms-bmp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  102) WebKit MIME Types
       Should support WebKit's 'image/x-windows-bmp':
     AssertionError [ERR_ASSERTION]: false === 'image/x-windows-bmp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  103) WebKit MIME Types
       Should support WebKit's 'image/x-bmp':
     AssertionError [ERR_ASSERTION]: false === 'image/x-bmp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  104) WebKit MIME Types
       Should support WebKit's 'image/x-bitmap':
     AssertionError [ERR_ASSERTION]: false === 'image/x-bitmap'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  105) WebKit MIME Types
       Should support WebKit's 'image/x-ms-bitmap':
     AssertionError [ERR_ASSERTION]: false === 'image/x-ms-bitmap'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  106) WebKit MIME Types
       Should support WebKit's 'image/jpg':
     AssertionError [ERR_ASSERTION]: false === 'image/jpg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  107) WebKit MIME Types
       Should support WebKit's 'image/pjpeg':
     AssertionError [ERR_ASSERTION]: false === 'image/pjpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  108) WebKit MIME Types
       Should support WebKit's 'image/x-png':
     AssertionError [ERR_ASSERTION]: false === 'image/x-png'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  109) WebKit MIME Types
       Should support WebKit's 'image/vnd.rim.png':
     AssertionError [ERR_ASSERTION]: false === 'image/vnd.rim.png'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  110) WebKit MIME Types
       Should support WebKit's 'image/ico':
     AssertionError [ERR_ASSERTION]: false === 'image/ico'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  111) WebKit MIME Types
       Should support WebKit's 'image/icon':
     AssertionError [ERR_ASSERTION]: false === 'image/icon'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  112) WebKit MIME Types
       Should support WebKit's 'text/ico':
     AssertionError [ERR_ASSERTION]: false === 'text/ico'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  113) WebKit MIME Types
       Should support WebKit's 'application/ico':
     AssertionError [ERR_ASSERTION]: false === 'application/ico'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  114) WebKit MIME Types
       Should support WebKit's 'image/x-icon':
     AssertionError [ERR_ASSERTION]: false === 'image/x-icon'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  115) WebKit MIME Types
       Should support WebKit's 'audio/vnd.qcelp':
     AssertionError [ERR_ASSERTION]: false === 'audio/vnd.qcelp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  116) WebKit MIME Types
       Should support WebKit's 'audio/qcp':
     AssertionError [ERR_ASSERTION]: false === 'audio/qcp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  117) WebKit MIME Types
       Should support WebKit's 'audio/vnd.qcp':
     AssertionError [ERR_ASSERTION]: false === 'audio/vnd.qcp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  118) WebKit MIME Types
       Should support WebKit's 'audio/wav':
     AssertionError [ERR_ASSERTION]: false === 'audio/wav'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  119) WebKit MIME Types
       Should support WebKit's 'audio/vnd.wave':
     AssertionError [ERR_ASSERTION]: false === 'audio/vnd.wave'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  120) WebKit MIME Types
       Should support WebKit's 'audio/mid':
     AssertionError [ERR_ASSERTION]: false === 'audio/mid'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  121) WebKit MIME Types
       Should support WebKit's 'audio/sp-midi':
     AssertionError [ERR_ASSERTION]: false === 'audio/sp-midi'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  122) WebKit MIME Types
       Should support WebKit's 'audio/x-mid':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mid'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  123) WebKit MIME Types
       Should support WebKit's 'audio/x-midi':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-midi'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  124) WebKit MIME Types
       Should support WebKit's 'audio/x-mpeg':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpeg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  125) WebKit MIME Types
       Should support WebKit's 'audio/mp3':
     AssertionError [ERR_ASSERTION]: false === 'audio/mp3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  126) WebKit MIME Types
       Should support WebKit's 'audio/x-mp3':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mp3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  127) WebKit MIME Types
       Should support WebKit's 'audio/mpeg3':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpeg3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  128) WebKit MIME Types
       Should support WebKit's 'audio/x-mpeg3':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpeg3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  129) WebKit MIME Types
       Should support WebKit's 'audio/mpg3':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpg3'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  130) WebKit MIME Types
       Should support WebKit's 'audio/mpg':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  131) WebKit MIME Types
       Should support WebKit's 'audio/x-mpg':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mpg'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  132) WebKit MIME Types
       Should support WebKit's 'audio/m4a':
     AssertionError [ERR_ASSERTION]: false === 'audio/m4a'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  133) WebKit MIME Types
       Should support WebKit's 'audio/x-m4a':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-m4a'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  134) WebKit MIME Types
       Should support WebKit's 'audio/x-mp4':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-mp4'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  135) WebKit MIME Types
       Should support WebKit's 'audio/x-aac':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-aac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  136) WebKit MIME Types
       Should support WebKit's 'audio/x-amr':
     AssertionError [ERR_ASSERTION]: false === 'audio/x-amr'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  137) WebKit MIME Types
       Should support WebKit's 'audio/mpegurl':
     AssertionError [ERR_ASSERTION]: false === 'audio/mpegurl'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  138) WebKit MIME Types
       Should support WebKit's 'audio/flac':
     AssertionError [ERR_ASSERTION]: false === 'audio/flac'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  139) WebKit MIME Types
       Should support WebKit's 'video/3gp':
     AssertionError [ERR_ASSERTION]: false === 'video/3gp'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  140) WebKit MIME Types
       Should support WebKit's 'video/avi':
     AssertionError [ERR_ASSERTION]: false === 'video/avi'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  141) WebKit MIME Types
       Should support WebKit's 'video/x-m4v':
     AssertionError [ERR_ASSERTION]: false === 'video/x-m4v'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  142) WebKit MIME Types
       Should support WebKit's 'video/x-quicktime':
     AssertionError [ERR_ASSERTION]: false === 'video/x-quicktime'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  143) WebKit MIME Types
       Should support WebKit's 'application/java':
     AssertionError [ERR_ASSERTION]: false === 'application/java'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  144) WebKit MIME Types
       Should support WebKit's 'application/x-java-archive':
     AssertionError [ERR_ASSERTION]: false === 'application/x-java-archive'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  145) WebKit MIME Types
       Should support WebKit's 'application/x-zip-compressed':
     AssertionError [ERR_ASSERTION]: false === 'application/x-zip-compressed'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

  146) WebKit MIME Types
       Should support WebKit's 'text/cache-manifest':
     AssertionError [ERR_ASSERTION]: false === 'text/cache-manifest'
      at extensions.forEach (test/test.js:28:32)
      at Array.forEach (<anonymous>)
      at Context.it (test/test.js:27:32)

npm ERR! Test failed.  See above for more details.

Include mime-types code, and alias mime-db to our db

The code in mime-types is exactly what I want to mimic, with the exception of the single line that imports mime-db from node_modules vs. using our db. Rather than write or copy the code manually, I'm thinking to do the following:

  • use parcel's alias to allow me to hack how require() resolves the mime-db dep at build time.
  • if necessary, create a git subtree for the code, squashing it down, and landing it all in mime-types/. It might make just as much sense to just write a simple object that copies the methods off the exports for mime-types and use that.

Figure out workaround for 416 range errors with media types

A bunch of media types fail to load properly with the express server:

JSON parsing error for mime type='video/mp4': Failed to load resource: the server responded with a status of 416 (Requested Range Not Satisfiable)
JSON parsing error for mime type='video/ogg': Failed to load resource: the server responded with a status of 416 (Requested Range Not Satisfiable)
JSON parsing error for mime type='video/webm': Failed to load resource: the server responded with a status of 416 (Requested Range Not Satisfiable)

This is probably my fault: I'm sending an empty (0 bytes) file, and the browser is requesting a range that doesn't make sense. I haven't figured out a way to get express to not process range requrests. Accept-Range none doesn't seem to work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.