munksgaard / elm-data-uri / DataUri

Parse and handle data URIs in Elm.

Types


type alias DataUri =
{ mediaType : MediaType
, data : Data 
}

The contents of the data URI


type Data
    = Base64 Bytes
    | Raw String

The data contained within a aata URI can either be base64 encoded raw bytes or a URL encoded string.

Parsing

fromString : String -> Maybe DataUri

Attempt to parse a string as a data URI.

parser : Parser DataUri

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.