The mimetypes converts between a filename or URL and the MIME type associated with the filename extension. Conversions are provided from filename to MIME type and from MIME type to filename extension; encodings are not supported for the later conversion.
The functions described below provide the primary interface for this module. If the module has not been initialized, they will call init().
(type, encoding)
where
type is None
if the type can't be guessed (no or unknown
suffix) or a string of the form 'type/subtype'
,
usable for a MIME content-type
header; and
encoding is None
for no encoding or the name of the program used
to encode (e.g. compress or gzip). The encoding
is suitable for use as a content-encoding
header,
not as a content-transfer-encoding
header. The mappings
are table driven. Encoding suffixes are case sensitive; type suffixes
are first tried case sensitive, then case insensitive.
None
is returned.
Some additional functions and data items are available for controlling the behavior of the module.
knownfiles
. Each file named in files or
knownfiles
takes precedence over those named before it.
Calling init() repeatedly is allowed.
'type/subtype'
. If the file filename does
not exist or cannot be read, None
is returned.
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant