/**
* @param {Uint8Array} bytes
* @returns {string}
*/
function base64Encode(bytes) {
var binary = "";
var bytes = new Uint8Array(buffer);
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return globalThis.btoa(binary);
}
You use bytes as both an argument name and a local var name, but don't define buffer. I believe this is a typo.
You use
bytes
as both an argument name and a local var name, but don't definebuffer
. I believe this is a typo.