I'm developing an Azure Pipelines extension in Typescript following their documentation
At some point I need to encode base64 a string. I tried using the btoa()
function but the pipeline fails -> ##[error]btoa is not defined
async function run() {
try {
const someString = "xxx"
//Encode Base64 someString
const sonarqubeTokenBase64 = btoa(`${someString}:`)
} catch (err) {
tl.setResult(tl.TaskResult.Failed, err.message);
}
}
How can I encode a string in this extension?