jshttp / mime-db Goto Github PK
View Code? Open in Web Editor NEWMedia Type Database
License: MIT License
Media Type Database
License: MIT License
nodemon /.../server.js -debug -e json,js
SyntaxError: /.../node_modules/express/node_modules/connect/node_modules/errorhandler/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/db.json: Unexpected token v
at Object.parse (native)
at Object.Module._extensions..json (module.js:482:27)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/.../node_modules/express/node_modules/connect/node_modules/errorhandler/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/index.js:11:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
This seems to a tricky issue.
Mime type image/svg+xml has svg and svgz listed, and is marked compressible.
svg is plain text is expectedly compressible. However, svgz is already zip compressed format and should be not compressible.
You may know that nginx another wide popular proxy server, and it has own mime.types db.
That is nearest link. It is short but for some mime types it has additional extenisions.
Hello,
I was wondering if the mentioned file extensions are going to be supported at some point. After checking around the recommended mime type for them is application/gzip
but I might be wrong.
Looking forward to any feedback
before i release 1.0.0.
@hueniverse: if this looks good to you, i'll add you (and whoever else) as owner as well
these extensions are missing
These are pointless.
Thoughts about adding a property like commonName
that provides a short, commonly used label for certain types?
e.g.
text/calendar is commonly known as iCalendar.
This is coming up for me because I am building an app that displays file types as a dropdown list for end users.
https://www.iana.org/assignments/media-types/application/dash+xml
application/dash+xml is registered for file extension "mpd", not "mdp".
related standard ISO/IEC 23009-1:2014
master currently references "mdp" in two places that i saw:
https://github.com/jshttp/mime-db/blob/master/db.json#L220
https://github.com/jshttp/mime-db/blob/master/src/custom-types.json#L21
I wish to add a type for .sha256 extensions (and perhaps other cyphers). Any thoughts?
Extension is step
or stp
One thing that would be nice would be a way to go from extension to mime-type(s), encoding, compressing info, etc. Perhaps it could be generated as a second file in your build step.
This project is a great idea, well done.
KALML
This one's a bit tricky. The same file type is associated with two mime types depending on the shader type.
The json would look like this:
{
"x-shader/x-fragment": [
"shader"
],
"x-shader/x-vertex": [
"shader"
]
}
Source: https://developer.mozilla.org/en-US/docs/Web/WebGL/Adding_2D_content_to_a_WebGL_context
Currently SVGZ
files are marked as compressible.
Lines 5866 to 5867 in 63731b4
This should not be the case as SVGZ
files are basically SVG
files compressed with gzip
, so they are already compressed.
From https://www.w3.org/TR/SVG/intro.html#MIMEType:
It is recommended that gzip-compressed [RFC1952] SVG files have the extension ".svgz" (all lowercase) on all platforms.
Sometimes we'd want to lookup a file extension from a given mimetype. For example, we want to get "js" if we are given a mimetype "text/javascript". This is currently not possible since the "extensions" key for "text/javascript" is not defined.
I'd suggest that we define an obsolete mimetype, such as "text/javascript", like this:
"text/javascript": {
"source": "iana",
"compressible": true,
"obsolete": true,
"extensions": ["js"]
},
So that the application is able to get an extension when "text/javascript" is given. If the application wants to reversely look for the mimetype for "js", it can ignore the "text/javascript" according to its "obsolete" value.
We can optionally add a "canonical": "application/javascript"
to indicate what this obsolete mimetype is now redirected to.
The font
top-level media type has been registered, so the new media types for font files are as follows:
Font format | Media type |
---|---|
collection |
font/collection |
otf |
font/otf |
sfnt |
font/sfnt |
ttf |
font/ttf |
woff |
font/woff |
woff2 |
font/woff2 |
See also: https://www.iana.org/assignments/media-types/media-types.xhtml#font
@dougwilson I did run the fetch-iana
script but it doesn't seem to get these updates. Let me know if you are open to updating custom.json
.
Friendly suggestion to add perceived type to each mime type. This would make it easier to distinguish between types of media such as video, audio, graphics, text, etc. The first part of a mime type is not always the deciding factor, after all. Plus there are agnostic mime groups, like application.
Perhaps perceived type could be left out when the mime group makes it clear by itself.
By default mime type for .csv
files should be text/csv
. However in case when target OS is MS Windows and MS Office is also installed on that system mime type for that file will be application/vnd.ms-excel
I was able to reproduce this issue on Win 8 and Win 10 and latest MS Office. Also I have found few links where sames issue or issues based on this are discussed
I do not know right way how we should go with this, but I am sure we need a place where all bits on this issue will be gathered together
win10+office2016
win10+libreoffice
I use https://github.com/broofa/node-mime which uses this module.
This file: http://download.mp3tag.de/mp3tagv271setup.exe
Has Content-Type
header: application/x-msdos-program
I google'd and application/x-msdos-program
's extension is .exe
.
audio/x-vorbis
, audio/x-vorbis+ogg
โ ogg
PR #53
Before:
"image/jpeg": {
"extensions": ["jpeg","jpg"]
},
After:
"image/jpeg": {
"extensions": ["jpg","jpeg"]
},
Why?
mime-types
module has an .extension(type)
method that returns first extension in this array, which is the horrible and ugly jpeg
that none prefers over jpg
, so I always have to do:
let ext = mime.extension(type);
if (ext === 'jpeg') ext = 'jpg';
Or modify the extensions
array at the start of my app (effectively detaching it from the affected code), than forgetting I did that, move to another project, and have to debug why are my files .jpeg
s again.
In general it would be great to move the preferred extension in each extensions
array to its 1st index. But this one is the one that will solve 99% of the frustrating "not a preferred extension" encounters.
It's just another one of those paper cuts that kill the joy of programming.
with iOS 11 this is going to be a big issue..
This is a list of sources for any custom mime types.
When adding custom mime types, please link to where you found the mime type,
even if it's from an unofficial source.
text/coffeescript
- http://coffeescript.org/#scriptstext/x-handlebars-template
- https://handlebarsjs.com/#getting-startedtext/x-sass
& text/x-scss
- https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xmltext.jsx
- http://facebook.github.io/react/docs/getting-started.html [2]font/opentype
- This type is technically invalid according to the spec. No valid types begin with font/
. No-one uses the official type of application/vnd.ms-opentype
as the community standardized application/x-font-otf
. However, chrome logs nonsense warnings unless opentype fonts are served with font/opentype
. [1]The MIME-Type for .vdf
files don't exists in the Database.
Extension: .vdf
Name: Valve Data File
Documentation: https://developer.valvesoftware.com/wiki/KeyValues
Conflicts: .vdf
will be used by Avira
(https://www.avira.com/en/support-vdf-details)
I was suggested to create a ticket here instead. The original is at broofa/mime#159
I'm getting this error and no matter what I do I can't get rid of it.
I'm using typescript v2.3.4
node v7.8.0 (though seeing the same issue with 7.4.0)
and my tsconfig is:
{
"compilerOptions": {
"alwaysStrict": true,
"outDir": "built",
"lib": [ "es6" ],
"module": "commonjs",
"target": "es6",
"pretty": true,
"removeComments": true,
"sourceMap": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}
I've ran npm cache clean
and re-installed all my node modules.
If I delete my generated built folder and run the code, everything works as expected but when I run it again, I get the above error. Any ideas?
Follow the same logic in #110. I think we can add to custom-suffix.json that "+xml" as compressible and "+zip" as not compressible.
Since we defined the 1.0 of the mime-db it has worked well, expect for one of the properties: compressible
. This property cannot be derived from the upstream data and instead rules must live in this repo to populate the value. By itself, this is not too bad, but it adds additional complexity to the module as well as inflates the size of the database for something many may not even use.
I'm thinking that a 2.0 version should drop this property from the database format and all related rules from this module.
The compressible data and ruleset would live on still, under the npm module compressible
. Instead of delegating to this module for compressible data, it would instead be the store of all the rules (and would not even need to depend on this module).
I'm opening this up for thoughts on this proposal, especially for those who are dependent on the database format. I'm not planning to make any changes for quite some time. Perhaps in a few months at the earliest, so there is plenty of time for feedback to fall here, if any.
"application/font-woff":["woff"],"application/font-woff2":["woff2"],
is
"font/woff":["woff"],"font/woff2":["woff2"],
Proof example:
wget -v https://fonts.gstatic.com/s/roboto/v16/ek4gzZ-GeXAPcSbHtCeQI_esZW2xOQ-xsNqO47m55DA.woff2
> mimeTypes.lookup('aac')
'audio/x-aac'
audio/aac
is a thing according to https://en.wikipedia.org/wiki/Advanced_Audio_Coding. This is also what MDN says the type should at https://goo.gl/lHrFU6.
(Note: this isn't breaking anything for me... I just happened to notice this discrepancy while working up some new tests for node-mime)
No .cr2 / .nef / .raw / .dng and others photo related mimetypes/ext
Hi there. Thanks for this great project.
I did have a question however. Currently image/jxr
is sitting in "limbo" at IANA however it is actively being used in Windows 10 Edge browsers. Our site has received a few of these requests already.
It is also my understanding that the .jxr
extension Media Type (MIME for us more tenured folks) used to be image/vnd.ms-photo
from a few reads throughout the internet.
My questions are fairly simple... are those PSMTR entries considered when making the database? Should they be?
Thanks so much.
Shouldn't .m3u8 files be compressible since they are essentially just text?
filename = audiofile.mp3
mimetype: audio/mpeg
extension: mpga
temporary workaround is modify db.json (see below)
before:
"audio/mpeg": {
"source": "iana",
"compressible": false,
"extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"]
after:
"audio/mpeg": {
"source": "iana",
"compressible": false,
"extensions": ["mp3","mpga","mp2","mp2a","m2a","m3a"]
waiting your feedback.
Regards,
Giuseppe
Running into an issue where files with the extension .mov
are getting the mimetype video/qucktime
, and then if we decode the mimetype it comes back as .qt
.
You can see that apache has updated their spec here: https://issues.apache.org/jira/browse/TIKA-1882
Hi,
In the 21st century, UTF-8 became de facto the standard for www.
In order to not overwrite thousands of http-server, it's enough to change "text/html" to "text/html;charset=UTF-8" in mime-types by default.
This does not change the work of old html-documents in any way, but instantly includes the correct display of many-many new languages.
"text/html;charset=UTF-8": {
"source": "iana",
"compressible": true,
"extensions": ["html","htm","shtml"]
}
We need a better way to manage extension priority for multiple types (i.e. provide an extension -> mime mapping).
The reason we need this is because as we source from more places, you cannot just build this mapping in other libraries by iterating over the types and just accumulating the extensions in a map, as they may not be in the most optimal order.
Looks like this package is released at version v1.14.0 on npm but when i install it via npm install mime-db
I get v1.13.0
would be nice, especially for mime types that aren't text/
. i want to know if i could treat a file as a string. might be able to get rid of charset as well.
Add the mime type text/asciidoc
for AsciiDoc files. AsciiDoc files commonly end with .adoc
, though the extensions .asciidoc
, .asc
, and sometimes .ad
are also recognized. If we have to pick only one, it should be .adoc
.
The mime type text/asciidoc follows the pattern used for Markdown, a very similar language. (see http://www.iana.org/assignments/media-types/text/markdown).
Hi.
I havs small application that proxy pages (basically download pages and associated resources) and i noticed that some sites return woff fonts with font/woff
, i did not notice this module has this content-type.
Are there any plans to add magic number support to deduce the mime-type for a Buffer?
e.g. "ff d8 ff e0" for "image/jpeg"
GitHub Pages uses mime-db to decide what content type to use when serving static files. This means that a static file named "index.php" will be served with the MIME type "application/x-httpd-php" which makes the browser download the file instead of interpreting it. This makes it impossible for an existing web site, which happened to use PHP pages and ".php" extensions in its URLs, to migrate to GitHub Pages, without making all old links non-functional.
I suggest you change the MIME type for .php files to "text/html". This will make it possible for existing projects moving to GitHub Pages to preserve their existing URLs by creating static HTML files whose names match the old .php pages.
I initially reported this problem to GitHub Pages, and they directed me to file an issue here instead.
Hi,
I was facing issue in loading WOFF fonts while using Ionicons icon-font in my Express.js + Node application.
After some investigation I have found that either we need to update or add new entry for WOFF fonts in DB.json file as given below at line no 370.
application/x-font-woff
db.json line no 370: "application/x-font-woff"
Ref URL : http://stackoverflow.com/questions/3594823/mime-type-for-woff-fonts
I hope this will be helpful.
Thanks,
Jignesh Raval
There is a "Charset" key in the database, but it is not described in the "Data Structure" section of the README.mb
.
when setting the mime type for .wav files internet explore is a bit picky...
valid options are: audio/wav, audio/wave, audio/x-wave, audio/vnd.wave
Chrome happily accepts the "audio/x-wav" but IE does not.
See: broofa/mime#118
As broofa points out, "audio/wav" is the official type according to the IANA Waveform Audio File Format registration.
http://tools.ietf.org/html/draft-ema-vpim-wav-00
The code to read from the IANA database is using the template file link's name to determine the mime type; this is not always the same. Example is basically all the MIME type entries we have that contains vnd-
instead of vnd.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.