Skip to main content

decode

Function decode 

Source
pub fn decode(
    data: impl AsRef<[u8]>,
    alphabet: Alphabet,
) -> Result<Vec<u8>, DecodeError>
Available on crate feature alloc only.
Expand description

Decode Decodes a base64 string into bytes.

§Errors

Returns DecodeError if any character is invalid for the chosen Alphabet, the input length is not valid, or padding is incorrect.

§Example

let decoded = base64::decode(b"aGVsbG8=", base64::Alphabet::Standard).unwrap();
assert_eq!(decoded, b"hello");