Function in encoding coil-stdlib

decode

fn decode(string s) -> Result<Vec<byte>, string>
Import
use encoding::{decode};
Source: src/encoding.hy

Decodes standard Base64 text into bytes.

Parameters#

NameType
sstring

Returns#

Result<Vec<byte>, string>

Errors#

Returns Err when s has a character outside the Base64 alphabet or a length that is not a multiple of 4.

Examples#

use encoding::{decode, encode};
use tests::assert;
let bytes = decode("aGVsbG8=") ?? Vec::new();
assert!(bytes.len() == 5);
assert!(encode(bytes) == "aGVsbG8=");

See also#

  • encode: Encodes data as standard Base64 (RFC 4648 alphabet, with = padding).
↑ ↓ navigate ↵ open