Created
May 29, 2024 16:16
-
-
Save Rankarusu/97ce5b61da7ba40a0340c579f6098ba1 to your computer and use it in GitHub Desktop.
Simple conversion of files to base64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MacOS agents in Azure don't come with base64 installed, so we use node to convert our p8 file to base64 so we can use it in the deployment task | |
const fs = require("fs"); | |
// 0 is node | |
// 1 is location of this file | |
const filePath = process.argv[2]; | |
if (!filePath) { | |
throw new Error("no file path given"); | |
} | |
if (!fs.existsSync(filePath)) { | |
throw new Error("no such file: " + filePath); | |
} | |
const buffer = fs.readFileSync(filePath); | |
console.log(buffer.toString("base64")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment