Help

This Product Ideas board is currently undergoing updates, but please continue to submit your ideas.

Support for Base64 encode and decode within Automation Script

cancel
Showing results for 
Search instead for 
Did you mean: 
Karlstens
11 - Venus
11 - Venus
Status: New Ideas

I don't understand how both btoa() and atob() methods are supported within the Airtable Scripting App Extension, but not within an Automation Scripting Action.

https://developer.mozilla.org/en-US/docs/Web/API/btoa

https://developer.mozilla.org/en-US/docs/Web/API/atob

Base64 encode and decode is an absolute staple in system integrations. Can it please be included to the Automation Scripting environment?

To get me out of a tight spot, I have used the below function to substitute btoa()

 

function btoa(str) {
  let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  let result = '';
  let i = 0;
  let char1, char2, char3;
  
  while (i < str.length) {
    char1 = str.charCodeAt(i++);
    char2 = str.charCodeAt(i++);
    char3 = str.charCodeAt(i++);
    
    result += characters.charAt(char1 >> 2);
    result += characters.charAt(((char1 & 3) << 4) | (char2 >> 4));
    result += characters.charAt(((char2 & 15) << 2) | (char3 >> 6));
    result += characters.charAt(char3 & 63);
  }
  
  return result;
}

 

I think that this is rather unnecessary...