Lucu- HTTP Daemonic Library



MIME Type guessing by a file extension. This is a poor man's way of guessing MIME Types. It is simple and fast.

In general you don't have to use this module directly.



type ExtMap = Map String MIMETypeSource

Map from extension to MIME Type.

guessTypeByFileName :: ExtMap -> FilePath -> Maybe MIMETypeSource

Guess the MIME Type of file.

parseExtMapFile :: FilePath -> IO ExtMapSource

Read an Apache mime.types and parse it.

serializeExtMap :: ExtMap -> String -> String -> StringSource

serializeExtMap extMap moduleName variableName generates a Haskell source code which contains the following things:

  • A definition of module named moduleName.
  • variableName :: ExtMap whose content is a serialization of extMap.

The module Network.HTTP.Lucu.MIMEType.DefaultExtensionMap is surely generated using this function.