munksgaard/elm-media-type/1.1.1

MediaType

Parse and handle media types in Elm.

Types

type alias MediaType =
{ type_ : Type
, registrationTree : Maybe String
, subtype : String
, suffix : Maybe String
, parameters : Dict String String
}

A media type.

type Type
= Application
| Audio
| Example
| Font
| Image
| Message
| Model
| Multipart
| Text
| Video

Media type types.

I didn't pick the name...

Based on the list from https://en.wikipedia.org/w/index.php?title=Media_type&oldid=881155761#Naming

Parsing

fromString : String -> Maybe MediaType

Attempt to parse a string as a media type.

toString : MediaType -> String

Convert a media type back into a string.

parser : Parser MediaType

Media types can be a part of another data schema, like the data URI scheme, so it can be helpful to access the internal parser.