Skip to content

Commit

Permalink
fix: decode function
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Jan 25, 2023
1 parent bdbe585 commit 0e915dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Deno.writeTextFileSync(
OUT_FILE,
`const BASE64 = "${
encode(Deno.readFileSync(BIN_FILE))
}";\nfunction decode(b64) {\n const binString = atob(b64);\n const size = binString.length;\n const bytes = new Uint8Array(size); \n for (let i = 0; i < size; i++) {\n bytes[i] = binString.charCodeAt(i);\n }\n return bytes;\n}\nconst DECODED = Deno.build.os === "${Deno.build.os}" && Deno.build.arch === "${Deno.build.arch}" ? Deno.core.ops.op_base64_decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`,
}";\nfunction decode(b64) {\n const binString = atob(b64);\n const size = binString.length;\n const bytes = new Uint8Array(size); \n for (let i = 0; i < size; i++) {\n bytes[i] = binString.charCodeAt(i);\n }\n return bytes;\n}\nconst DECODED = Deno.build.os === "${Deno.build.os}" && Deno.build.arch === "${Deno.build.arch}" ? decode(BASE64) : new Uint8Array();\nexport default DECODED;\n`,
);

console.log(`%cWrote ${OUT_FILE}`, "color: #888");

0 comments on commit 0e915dd

Please sign in to comment.