chelovek0v / bbase64 / Base64.Decode

The Decode module enables you to decode Base64 strings into certain values.

Decoders


type Decoder a

A decoder type that knows how to decode a Base64 string.

string : Decoder String

String Decoder.

bytes : Decoder Bytes

Bytes Decoder.

Decoding

decode : Decoder a -> String -> Result Error a

Turn a Decoder into a certain value.

Decoding can fail, see Error.

map : (a -> b) -> Decoder a -> Decoder b

Transforms the value produced by a decoder.


type Error
    = ValidationError
    | InvalidByteSequence

Errors that can occur during a decoding:

Base64.Decode.decode Base64.Decode.string "a===" == Err ValidationError

Base64.Decode.decode Base64.Decode.string "/Ng9" == Err InvalidByteSequence