I have an blob within Google Apps Script. How can I convert it to an base64 encoded string in order to write it to other APIs? FileReader seems not to work ...
Asked
Active
Viewed 1,764 times
2 Answers
0
const convertImageToDataUri = () => {
const imageUrl = 'https://i.imgur.com/6rl9Atu.png';
const blob = UrlFetchApp.fetch(imageUrl).getBlob();
const base64String = Utilities.base64Encode(blob.getBytes());
return `data:image/png;base64,${base64String}`;
};

Sonu Kumar
- 1
- 1