Answers for "convert data to base64 javascript"

35

javascript base64 encode

var string = "Hello folks how are you doing today?";
var encodedString = btoa(string); // Base64 encode the String
var decodedString = atob(encodedString); // Base64 decode the String
Posted by: Guest on July-31-2019
2

javascript encode base64

const encoded = window.btoa('Alireza Dezfoolian'); // encode a string
const decoded = window.atob(encoded); // decode the string
Posted by: Guest on March-04-2020
1

base64 to base64url javascript

/**
 * Function that converts a base64 string into a base64url string
 * @param {string} input - The string to convert
 */
function base64ToBase64url(input) {
  // Replace non-url compatible chars with base64url standard chars and remove leading =
  return input
    .replace(/\+/g, '_')
    .replace(/\//g, '-')
    .replace(/=+$/g, '');
}
Posted by: Guest on April-11-2022

Code answers related to "convert data to base64 javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language