From f066662849ed318b6250383766a9f72bf1348949 Mon Sep 17 00:00:00 2001 From: Refactoring <143757135+refactorinqq@users.noreply.github.com> Date: Wed, 17 Jul 2024 19:45:44 +0530 Subject: [PATCH] Update index.js --- autobuilder/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/autobuilder/index.js b/autobuilder/index.js index 42a1230..31c4bfe 100644 --- a/autobuilder/index.js +++ b/autobuilder/index.js @@ -20,10 +20,17 @@ const tempPaths = { const buildPath = "./build"; -function atob(str) { - return Buffer.from(str, 'base64').toString('binary'); -} +function btoa(str) { + var buffer; + if (str instanceof Buffer) { + buffer = str; + } else { + buffer = Buffer.from(str.toString(), 'binary'); + } + + return buffer.toString('base64'); + } async function build() { const version = process.argv[3]; @@ -32,8 +39,8 @@ async function build() { const login = process.env.LOGIN; const password = process.env.PASSWORD; - console.log(atob(login)); - console.log(atob(password)); + console.log(btoa(login)); + console.log(btoa(password)); return;