Skip to content

Instantly share code, notes, and snippets.

@Rankarusu
Created May 29, 2024 16:16
Show Gist options
  • Save Rankarusu/97ce5b61da7ba40a0340c579f6098ba1 to your computer and use it in GitHub Desktop.
Save Rankarusu/97ce5b61da7ba40a0340c579f6098ba1 to your computer and use it in GitHub Desktop.
Simple conversion of files to base64
// 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