Skip to main content

Convert a base64 encoded string to an uint8 array

JavaScript version

const base64ToUint8 = (str) =>
Uint8Array.from(atob(str), (c) => c.charCodeAt(0));

TypeScript version

const base64ToUint8 = (str: string): Uint8Array =>
Uint8Array.from(atob(str), (c) => c.charCodeAt(0));

See also

Comments