guessMediaType - guess media type for a file or an URL.
mediaSuffix - returns file extentions for a media type
This module provides functions for handling of media (also known as MIME) types and encodings. The mapping from file extentions to media types is defined by the media.types file. If the ~/.media.types file exist it is used as a replacement.
For backwards compatability we will also look for ~/.mime.types.
This function tries to guess media type and encoding for given file. In scalar context it returns only the content-type. In array context it returns an array consisting of content-type followed by any content-encodings applied.
The guessMediaType function also accepts an URI::URL object as argument.
If the type can not be deduced from looking at the file name only, then guessMediaType() will take a look at the actual file using the
-T perl operator in order to determine if this is a text file (text/plain). If this does not work it will return application/octet-stream as the type.
This function will return all suffixes that can be used to denote the specified media type. Wildcard types can be used.