
mimetype.pl -- Determine mime-type for a fileSimple library to guess the mime-type from the extension of a file. As various applications need to do this type of inferencing it seems worthwhile to place this functionality in an extensible library.
file_mime_type(+FileName, -MimeType) is semidet
default_mimetype(-MimeType) is semidet[private]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]
name_mimetype(+DownCaseFileName, -MimeType) is semidet[private]
text_mimetype(+MimeType) is semidet[private]
file_content_type(+File:atom, -ContentType:atom) is det
file_content_type(+File:atom, ?MediaType, -ContentType:atom) is detContentType: ContentType. It
takes the following steps:
default_charsetThe behavior is controlled by several hooks and a flag.
default_charset defines the charset unless it is set
to -. The flag set by default to UTF-8 if the Prolog
flag encoding is set to utf8.