Convert a base64-encoded string to a Uint8Array.
This function works in both browser and Node.js environments. Uses atob which is available in browsers and Node.js 16+.
A base64-encoded string
The decoded byte array
fromBase64("SGVsbG8="); // Uint8Array([72, 101, 108, 108, 111]) Copy
fromBase64("SGVsbG8="); // Uint8Array([72, 101, 108, 108, 111])
Convert a base64-encoded string to a Uint8Array.
This function works in both browser and Node.js environments. Uses atob which is available in browsers and Node.js 16+.