def to_base64

bend-kit-bytes@0.3.3.0 · bytes.bend:713

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

713# Base64 (RFC 4648 §4) with '=' padding.
714def to_base64(b: Bytes) -> String:
715  Bytes{+len, buf} = b
716  +q = (len / 3 : U32)
717  +t = (q * 3 : U32)
718  b64.tail((len - t : U32), t, q, uint.go(U32.to_nat((len - t : U32)), peek(buf, t), t, True{}, 0))

Uses (11)

Used by (12)