function encode(data) {
  if (typeof data === "string") {
    return btoa(data);
  } else {
    const d = new Uint8Array(data);
    let dataString = "";
    for (let i = 0; i < d.length; ++i) {
      dataString += String.fromCharCode(d[i]);
    }
    return btoa(dataString);
  }
}
/**
 * Converts given data with base64 encoding
 * @param data input to encode
 */
Converts given data with base64 encoding
@param data input to encode
Converts given data with base64 encoding @param data input to encode
function encode(data) {
  if (typeof data === "string") {
    return btoa(data);
  } else {
    const d = new Uint8Array(data);
    let dataString = "";
    for (let i = 0; i < d.length; ++i) {
      dataString += String.fromCharCode(d[i]);
    }
    return btoa(dataString);
  }
}
function encode ( data ) { if ( typeof data === "string" ) { return btoa ( data ) ; } else { const d = new Uint8Array ( data ) ; let dataString = "" ; for ( let i = 0 ; i < d . length ; ++ i ) { dataString += String . fromCharCode ( d [ i ] ) ; } return btoa ( dataString ) ; } }
Converts given data with base64 encoding
 @param data input to encode
Converts given data with base64 encoding @param data input to encode