UNPKG

decode-base64

Version:

A tiny function for decoding base64 strings into Uint8Arrays, useful for bundling and loading WASM modules.

12 lines (11 loc) 270 B
/* MAIN */ const decode = (base64) => { const binary = atob(base64); const u8 = new Uint8Array(binary.length); for (let i = 0, l = binary.length; i < l; i++) { u8[i] = binary.charCodeAt(i); } return u8; }; /* EXPORT */ export default decode;