mimetype.pl -- Determine mime-type for a file
Simple library to guess the mime-type from the extension of a file. As various applications need to do this type ofinferencing it seems worthwhile to place this functionality in an extensible library.
- file_mime_type(+FileName, -MimeType) is semidet
- True when MimeType is the mime-type to be used for sending FileName. The default rules can be overridden and extended using the hook mime:mime_extension/2.
- mime:mime_extension(+Ext, -MimeType) is semidet[multifile]
- Hook that is called by file_mime_type/2 before the default table is examined.
- default_mimetype(-MimeType) is semidet[private]
- If the mime-type cannot be determined from the file extension,
this predicate is used as fallback. It takes the value from the
Prolog flag
default_mimetype
. To change the default, use e.g.,:- set_prolog_flag(default_mimetype, text/plain).
The initial default mime-type is
application/unknown
. Use the value-
to denote there is no default. - ext_mimetype(+Extension, -MimeType) is semidet[private]
- Built-in table of file-name extension to mime-type mappings.
- name_mimetype(+DownCaseFileName, -MimeType) is semidet[private]
- Determine the mime-type of files based on the entire filename.