bulky-kilobyte-26698
12/20/2023, 6:41 PMmillions-activity-52391
12/20/2023, 6:41 PMbulky-kilobyte-26698
12/20/2023, 6:44 PMfunction base64Encode(str) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let output = '';
for (let block = 0, charCode, i = 0, map = chars;
str.charAt(i | 0) || (map = '=', i % 1);
output += map.charAt(63 & block >> 8 - i % 1 * 8)) {
charCode = str.charCodeAt(i += 3/4);
if (charCode > 0xFF) {
throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');
}
block = block << 8 | charCode;
}
return output;
}millions-activity-52391
12/21/2023, 3:19 PMmillions-activity-52391
12/21/2023, 3:20 PMbrash-gpu-3903
01/25/2024, 5:33 AMencrypt library…i can’t see how to use it to do the equivalent of Buffer.from('some_value').toString('base64') or equivalent with btoa
do you have an example using the encrypt library?millions-activity-52391
01/29/2024, 5:31 PMmillions-activity-52391
01/30/2024, 12:17 PM