Double B Double B - 8 months ago 86
Javascript Question

Change node.js Buffer(BASE64) to jQuery

Could you help me please, I had a program which written with Node.js. It has this part:

var b = new Buffer(text, 'base64');
var s = b.toString('hex');

Do you have any idea, how could I this code change to jQuery?
I tried this, but It is not give a good values:

var text = "ACfACRv7aEcAAAAAAAD//w=="; //23,31 was the value
var b = atob(text);
var s = b.toString('hex');

Thank you in advance.


Convert Base64 into hex :

var base64Image = 'MjMsMzE=';


function convertToHex(base64) {

var hex = '';
for(var i=0;i<base64.length;i++) {
    hex += ''+base64.charCodeAt(i).toString(16);
return hex;