It's as easy as a method call:
var encodedData = window.btoa("Hello world"); var decodedData = window.atob(encodedData);
btoa function takes a string and returns the base64 encoding of that string. It's a method of the window object and calls to native browser code. The
atob function does the reverse, taking a string containing base64 and returning a string with the binary ...