Most programmers know what a MIME type (or Media Type) is. It's the two-part identifier used by programs to determine the format of a file or data. In web development, MIME types are most commonly seen in HTTP requests as the value of the Content-Type
header. But what do the two different parts mean and what are their valid values?
The first part of a MIME type is called the top-level media type and it specifies the general type of the data. The top-level media type can be one of the 7 standard defined types, which consist of:
- text - textual information.
- image - image data.
- audio - audio data.
- video - video data.
- application - some other kind of data, typically either uninterpreted binary data or information to be processed by an application.
- multipart - data consisting of multiple entities of independent data types.
- message - an encapsulated message.
The second part is called the sub-type and it specifies the specific format of the data. There are thousands of registered sub-types, far too many to list here. However there's a list of registered MIME types on the IANA website.
The sub-type can also have one of the following optional prefixes to give it special meaning:
x-
- Unregistered or experimental. Example:image/x-icon
vnd.
- Vendor-specific. Example:application/vnd.ms-powerpoint
prs.
- Personal or vanity. Example:application/prs.roland
For more information, see the MIME type standard and registration documents.
GitHub Comments
sukima
Rowno
add comment via GitHubtype/x-whatever
is for unregistered or experimental while thetype/prs.whatever
is for personal or vanity. While that makes sense from a gramatical/vocabulary perspective when it comes to making a type of your own that you plan to use for your own application it leads little information on which one is most appropiot. Sadly, a Google search yields the same basic definitions and no guidance on which one to pick.Do you know what the contextual difference between those two are?
Sorry, I have no idea. 😄 But I'm guessing that with the
x-
prefix the intention is to eventually get it added to the standard like what happened with the WOFF mime type, which started life asapplication/x-font-woff
and then got standardised asapplication/font-woff
.