Answers for "javascript base64 encode string"

23

javascript base64 encode string

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
2

javascript base64 decode

var decodedString = atob(encodedString);
Posted by: Guest on May-14-2020
0

js base64 encoding

str = "The quick brown fox jumps over the lazy dog";
b64 = btoa(unescape(encodeURIComponent(str)));
str = decodeURIComponent(escape(window.atob(b64)));
Posted by: Guest on April-29-2021
-1

javascript base64url decode

var decode = function(input) {
        // Replace non-url compatible chars with base64 standard chars
        input = input
            .replace(/-/g, '+')
            .replace(/_/g, '/');

        // Pad out with standard base64 required padding characters
        var pad = input.length % 4;
        if(pad) {
          if(pad === 1) {
            throw new Error('InvalidLengthError: Input base64url string is the wrong length to determine padding');
          }
          input += new Array(5-pad).join('=');
        }

        return input;
    }
Posted by: Guest on November-14-2020

Code answers related to "javascript base64 encode string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language