Base64.Decode

Decode Base64 strings.

Decoders

string : String -> Result Error String

Decode a Base64 string as String.

bytes : String -> Result Error Bytes

Decode a Base64 string as Bytes.

type Error
= InvalidCharacter Char
| IncorrectPadding
| InvalidLength
| BytesToStringError

The errors that can happen when decoding a Base64 string.

  • InvalidCharacter happens when encountering an invalid character in the passed Base64 string.
  • IncorrectPadding happens when the Base64 string has padding (the = character) anywhere other than the the last two characters.
  • InvalidLength happens when the Base64 string is an invalid length
  • BytesToStringError happens only when using the string function in this module and there is a problem converting the decoded Bytes into a String.