← all modules
module

stdlib::base64

defined in C:\Users\bye45\.glide\bin/src/stdlib/base64.glide

Standard Base64 encode (RFC 4648, with `=` padding). Each group of

fn fn b64_encode(s: string) -> string

Standard Base64 encode (RFC 4648, with = padding). Each group of three input bytes becomes four output characters; the last group is padded so the output is always a multiple of four.

glide
b64_encode("Hello");      // "SGVsbG8="

b64_encode("foobar");     // "Zm9vYmFy"

b64_encode("");           // ""
fn fn b64_decode(s: string) -> !string

Inverse of b64_encode. Validates padding and alphabet; rejects stray characters (whitespace included) with err.

glide
let r: !string = b64_decode("SGVsbG8=");
if r.ok { println!(r.val); }      // "Hello"


let bad: !string = b64_decode("***");
if !bad.ok { println!(bad.err); } // "invalid base64 character"