τau /

encoding/base64

module
base64 = import("encoding/base64")

base64 - the encoding of RFC 4648.

EncodeToString uses the standard alphabet and pads with "=", which is what most things expect. URLEncodeToString uses "-" and "_" instead of "+" and "/", for what travels inside a URL or a filename.

EncodedLen = fn(n)source

EncodedLen is how long the encoding of n bytes is, padding included.

EncodeToString = fn(data)source

EncodeToString returns the base64 form of data, a string or bytes.

URLEncodeToString = fn(data)source

URLEncodeToString is EncodeToString with the URL safe alphabet and no padding, the form a token or a filename is written in.

DecodeString = fn(s)source

DecodeString returns the bytes s stands for. Both alphabets are understood and the padding is optional, since it carries nothing the length doesn't.