Encodes a UTF-8 string to its Base64 representation.
The plain text to encode.
The Base64-encoded string.
const b64 = Base64.Encode("hello"); // "aGVsbG8=" Copy
const b64 = Base64.Encode("hello"); // "aGVsbG8="
Decodes a Base64 string back to UTF-8 text.
The decoded plain text.
Throws a runtime error if the input is not valid Base64 or does not decode to valid UTF-8.
const plain = Base64.Decode("aGVsbG8="); // "hello" Copy
const plain = Base64.Decode("aGVsbG8="); // "hello"
Encodes a UTF-8 string to its Base64 representation.