1
0
Fork 0
mirror of synced 2025-09-23 04:08:33 +00:00

use buffer first, add changelog

This commit is contained in:
dark64 2023-01-23 13:52:42 +01:00
parent e66b3c8c5c
commit ca664cb1a0
2 changed files with 7 additions and 6 deletions

View file

@ -0,0 +1 @@
Optimize `zokrates-js` library size

View file

@ -18,17 +18,17 @@ import pako from "pako";
let bytes;
if (typeof atob === 'function') {
if (typeof Buffer === "function") {
bytes = Buffer.from(encoded, "base64");
} else if (typeof atob === "function") {
const binary = atob(encoded);
bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) {
bytes[i] = binary.charCodeAt(i);
}
} else if (typeof Buffer === 'function') {
bytes = Buffer.from(encoded, 'base64');
}
} else {
throw new Error('Unsupported platform');
throw new Error("Unsupported platform");
}
const imports = getImports();