Text.Pandoc.MIME

pandoc-3.7.0.2: Conversion between markup formats

Copyright | Copyright (C) 2011-2024 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Pandoc.MIME

Description

Mime type lookup.

Synopsis

- type MimeType = Text
- getMimeType :: FilePath -> Maybe MimeType
- getMimeTypeDef :: FilePath -> MimeType
- getCharset :: MimeType -> Maybe Text
- extensionFromMimeType :: MimeType -> Maybe Text
- mediaCategory :: FilePath -> Maybe Text

# Documentation

type MimeType = Text #

getMimeType :: FilePath -> Maybe MimeType #

Determine mime type appropriate for file path.

getMimeTypeDef :: FilePath -> MimeType #

Determime mime type appropriate for file path, defaulting to “application/octet-stream” if nothing else fits.

getCharset :: MimeType -> Maybe Text #

Get the charset from a mime type, if one is present.

extensionFromMimeType :: MimeType -> Maybe Text #

mediaCategory :: FilePath -> Maybe Text #

Determine general media category for file path, e.g.

    mediaCategory "foo.jpg" = Just "image"