Skip to content

Commit

Permalink
fix: now encoding keys will trim all unnecessary whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ghimiresdp committed Apr 10, 2023
1 parent 3877e8e commit 88e6b86
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/encode-google-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ if (path_idx < 1 || process.argv.length < path_idx) {

const filename = process.argv[path_idx];

let file = readFile(filename, (err, data) => {
let content = data.toString('base64');
readFile(filename, (err, data) => {
// removing unnecessary whitespaces
let key_trimmed = JSON.stringify(JSON.parse(data.toString()));
let key_base64 = new Buffer.from(key_trimmed).toString('base64');
console.log('\n', key_base64, '\n');

console.log(content, '\n');

writeFile(`${filename}.txt`, content, (err) => {
writeFile(filename.replace('.json', '.txt'), key_base64, (err) => {
if (err) {
console.log('Could not write to the file');
process.exit(1);
Expand Down

0 comments on commit 88e6b86

Please sign in to comment.