@dfinity/assets
Version:
JavaScript and TypeScript library to manage assets on the Internet Computer
19 lines • 637 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.base64Decode = base64Decode;
/**
* Decodes a base64 string into a Uint8Array.
* @param data - The base64 encoded string to decode
* @returns A Uint8Array containing the decoded data
*/
function base64Decode(data) {
// Convert base64 to binary string
const binaryString = atob(data);
// Convert binary string to Uint8Array
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes;
}
//# sourceMappingURL=base64.js.map