|
Data.MIME.Types | Portability | portable | Stability | provisional | Maintainer | John Goerzen <jgoerzen@complete.org> |
|
|
|
|
|
Description |
Utilities for guessing MIME types of files.
Written by John Goerzen, jgoerzen@complete.org
|
|
Synopsis |
|
|
|
|
Creating Lookup Objects
|
|
|
Default MIME type data to use
|
|
|
:: MIMETypeData | Data to work with
| -> Bool | Whether to work on strict data
| -> FilePath | File to read
| -> IO MIMETypeData | New object
| Read the given mime.types file and add it to an existing object.
Returns new object.
|
|
|
|
:: MIMETypeData | Data to work with
| -> Bool | Whether to work on strict data
| -> Handle | Handle to read from
| -> IO MIMETypeData | New object
| Load a mime.types file from an already-open handle.
|
|
|
|
Read the system's default mime.types files, and add the data contained
therein to the passed object, then return the new one.
|
|
Basic Access
|
|
|
Return value from guessing a file's type.
The first element of the tuple gives the MIME type. It is Nothing if no
suitable type could be found.
The second element gives the encoding. It is Nothing if there was no particular
encoding for the file, or if no encoding could be found.
|
|
|
Constructors | MIMETypeData | | suffixMap :: Map String String | A mapping used to expand common suffixes into equivolent,
better-parsed versions. For instance, .tgz would expand
into .tar.gz.
| encodingsMap :: Map String String | A mapping used to determine the encoding of a file.
This is used, for instance, to map .gz to gzip.
| typesMap :: Map String String | A mapping used to map extensions to MIME types.
| commonTypesMap :: Map String String | A mapping used to augment the typesMap when non-strict
lookups are used.
|
|
|
|
|
|
:: MIMETypeData | Source data for guessing
| -> Bool | Whether to limit to strict data
| -> String | File or URL name to consider
| -> MIMEResults | Result of guessing (see MIMEResults for details on interpreting it)
| Guess the type of a file given a filename or URL. The file
is not opened; only the name is considered.
|
|
|
|
:: MIMETypeData | Source data for guessing
| -> Bool | Whether to limit to strict data
| -> String | MIME type to consider
| -> Maybe String | Result of guessing, or Nothing if no match possible
| Guess the extension of a file based on its MIME type.
The return value includes the leading dot.
Returns Nothing if no extension could be found.
In the event that multiple possible extensions are available,
one of them will be picked and returned. The logic to select one
of these should be considered undefined.
|
|
|
|
:: MIMETypeData | Source data for guessing
| -> Bool | Whether to limit to strict data
| -> String | MIME type to consider
| -> [String] | Result of guessing
| Similar to guessExtension, but returns a list of all possible matching
extensions, or the empty list if there are no matches.
|
|
|
Produced by Haddock version 2.6.0 |