← index

Base64abstract

inherits Object

Base64 encoding between Bytes and text — the standard alphabet, with = padding.

The way to carry binary data through text-only formats (JSON has no bytes type). String#toBase64 / String#fromBase64 wrap these for the common string-to-string round trip.

Base64.encode:'hello'.asBytes            "* -> 'aGVsbG8='
(Base64.decode:'aGVsbG8=').asString      "* -> 'hello'

Class methods

decode:String

The Bytes a base64 String encodes — the inverse of encode:. Input that is not valid base64 throws a ValueError.

Base64.decode:'aGVsbG8='     "* -> Bytes[5] 68 65 6c 6c 6f

native

encode:Bytes

The base64 String for some Bytes (standard alphabet, padded).

Base64.encode:'hello'.asBytes     "* -> 'aGVsbG8='

native