MIME information files associate MIME types with one or both of the following:
Filename extensions
Filename patterns
When an application searches for the MIME type of a file, the application checks the filename against the MIME information files. If a match for the filename is found, the MIME type associated with the extension or pattern is the MIME type of the file.
In MIME information files, the filename pattern to search for is written as a regular expression.
The format of MIME type entries in MIME information files is as follows:
MIME-type ext[,priority]: list-of-extensions regex[,priority]: list-of-regular-expressions
You can specify a priority value for the filename extension and the regular expression. You can use the priority value to differentiate composite filenames. For example, you can assign a priority of 1 to the .gz extension, and assign a higher priority of 2 to the .tar.gz extension. In this case, the file abc.tar.gz takes the MIME type for .tar.gz.
You must indent the ext field and the regex field with a tab character (\t).
The following MIME type entries are samples from the gnome-vfs.mime MIME information file:
application/x-compressed-tar regex,2: tar\.gz$ ext: tgz audio/x-real-audio ext: rm ra ram image/jpeg ext: jpe jpeg jpg image/png ext: png text/html ext: html htm HTML text/plain ext: asc txt TXT text/x-readme regex: README.*
The file manager reads the MIME information files alphabetically. The alphabetical order determines the order in which MIME types are assigned to filename extensions or regular expressions. For example, if the same file extension is assigned to different MIME types in the files abc.mime and def.mime, the MIME type in abc.mime is used.