base64_decode
host callCapy
function base64_decode(value : string) any
Description
base64_decode decodes Base64 text into a string.
The result contains bytes, not necessarily UTF-8 text. Zero bytes survive decoding. ASCII whitespace is ignored. Use the standard + and / alphabet, not the URL-safe alphabet. After whitespace removal, the input length must be a multiple of four. Include = padding when needed.
Invalid Base64 text returns a failure. Empty input and whitespace-only input succeed with value: "".
Parameters
value : Base64 text
Return Values
{ok: true, value: ...} on success, or {ok: false, error: "..."} on failure. The value field contains the decoded string.
Example
Capy
print(base64_decode("aGVsbG8=").value ?? "", "\n")
Output
hello