Fast Base64 encoding and decoding for Bytes.
fromBytes encodes Bytes into a Base64 String.toBytes decodes a Base64 String into Bytes, with validation.toBytesUnsafe decodes a Base64 String into Bytes, without validation.Decode a Base64 string to Bytes, returning Nothing if the input
contains invalid characters or has an impossible length (e.g. 1 mod 4).
import Base64
import Bytes
Base64.toBytes "Zm9v"
|> Maybe.map Bytes.width
--> Just 3
Base64.toBytes "not valid!!"
--> NothingDecode a Base64 string to Bytes without validating the input.
This is faster than toBytes but will produce garbage output
if the input is not a valid Base64 string. Use this when you trust the
input (e.g. it was produced by fromBytes).
import Base64
import Bytes
Base64.toBytesUnsafe "Zm9v"
|> Bytes.width
--> 3
Encode
Bytesto a Base64 string.