Accepts input in either the standard alphabet of RFC 4648 § 4 or the URL-safe variant of RFC 4648 § 5, padded or
unpadded, restoring + / / in place of - / _ and reattaching any missing = padding before decoding the
underlying bytes as UTF-8.
Warning
Bytes that don't spell valid UTF-8 are not rejected: decoding replaces each malformed sequence with U+FFFD
REPLACEMENT CHARACTER, so a truncated or corrupted payload yields text rather than an error.
Parameters
encoded: string
The base64-encoded string, in either alphabet, padded or unpadded
Returns string
The decoded UTF-8 string, with every malformed byte sequence replaced by U+FFFD
Throws
InvalidCharacterError If encoded contains characters outside the standard and URL-safe base64 alphabets
Decodes a base64 string.
Accepts input in either the standard alphabet of RFC 4648 § 4 or the URL-safe variant of RFC 4648 § 5, padded or unpadded, restoring
+//in place of-/_and reattaching any missing=padding before decoding the underlying bytes as UTF-8.Bytes that don't spell valid UTF-8 are not rejected: decoding replaces each malformed sequence with
U+FFFDREPLACEMENT CHARACTER, so a truncated or corrupted payload yields text rather than an error.