| Gtk2Hs | Contents | Index

System.Gnome.VFS.MIME

Maintainer | gtk2hs-devel@lists.sourceforge.net Stability : alpha Portability : portable (depends on GHC)

Contents

Types
MIME Type Operations

Description
Synopsis

type MIMEType = String
mimeTypeFromNameOrDefault :: FilePath -> Maybe MIMEType -> Maybe MIMEType
getMIMETypeCommon :: URI -> IO String
getMIMETypeFromURI :: URI -> IO String
getFileMIMETypeFast :: FilePath -> IO String
getFileMIMEType :: FilePath -> Bool -> IO String
mimeTypeIsSupertype :: String -> Bool
getSupertypeFromMIMEType :: String -> String
mimeInfoCacheReload :: FilePath -> IO ()

Types
type MIMEType = String
A string that will be treated as a MIME-type.
MIME Type Operations
mimeTypeFromNameOrDefault

:: FilePath | `filename` - the file to get the MIME-type for
-> Maybe MIMEType | `defaultv` - the default MIME-type to return if no match is found
-> Maybe MIMEType | the MIME-type of the filename, or `defaultv`
Try to determine the MIME-type of the file at `filename`, using only the filename and the Gnome VFS MIME type database. If the MIME-type is not found, return `defaultv`.

getMIMETypeCommon

:: URI | `uri` - the URI of the file to examine
-> IO String | the guessed MIME-type

Try to get the MIME-type of the file represented by `uri`. This function favors the contents of the file over the extension of the filename. If the file does not exist, the MIME-type for the extension is returned. If no MIME-type can be found for the file, the function returns "application/octet-stream".

Note: This function will not necessarily return the same MIME-type as System.Gnome.VFS.Ops.getFileInfo.

getMIMETypeFromURI

:: URI | `uri` - the URI to examine
-> IO String | the guessed MIME-type
Try to get the MIME-type of the file represented by `uri`. This function looks only at the filename pointed to by `uri`.

getFileMIMETypeFast

:: FilePath |
-> IO String |

getFileMIMEType :: FilePath -> Bool -> IO String
Try to guess the MIME-type of the file represented by `path`. If `suffixOnly` is `False`, use the MIME-magic based lookup first. Handles non-existant files by returning a type based on the file extension.
mimeTypeIsSupertype :: String -> Bool
Returns `True` if `mimeType` is of the form `foo/*`, and `False` otherwise.
getSupertypeFromMIMEType :: String -> String
Returns the supertype for `mimeType`. The supertype of an application is computed by removing its suffix, and replacing it with `*`. Thus, `foo/bar` will be converted to `foo/*`.
mimeInfoCacheReload :: FilePath -> IO ()
Reload the MIME information for the specified directory.
Produced by Haddock version 2.4.2