Base64 encoded string.
Optionaloptions: DecodeBase64OptionsDecoding options.
Decoded Uint8Array.
const buffer = decodeBase64('SGVsbG8=');
console.log(buffer); // Uint8Array [72, 101, 108, 108, 111]
// Decode to string
const text = decodeUtf8(decodeBase64('SGVsbG8sIFdvcmxkIQ=='));
console.log(text); // 'Hello, World!'
// Base64url input
const bytes = decodeBase64('SGVsbG8', { alphabet: 'base64url' });
// Strict mode: require correct padding
decodeBase64('QQ==', { lastChunkHandling: 'strict' });
Converts a Base64 encoded string to Uint8Array.
Uses native
Uint8Array.fromBase64if available, otherwise pure JS fallback.