Question : decode base64 to string
Answered by : ahmad-hazim
const fromBase64toString = (data) => { return decodeURIComponent( atob(data) .split("") .map(function (c) { return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); }) .join("") ); };
Source : | Last Update : Sat, 23 Oct 21
Question : base64 to base64url
Answered by : quinten-hyn2mqahkri5
/** * 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, '');
}
Source : | Last Update : Mon, 18 Apr 22
Question : base 64
Answered by : clear-civet-c6y11hduz35y
base64String.replace(/^data:image\/(png|gif|jpeg|jpg|pdf);base64,/, "")
Source : | Last Update : Mon, 20 Dec 21