Convert buffer base64 -> utf8 encoding node.js
In order to convert from a base64 encoded String
to utf8 you can use the following:
var base64encoded = '0KHQvdCw0YfQsNC70LAg0YHQvtC30LTQsNC10YLRgdGPINGA0LXRiNC10YLQutCwINC/0YDQvtGB 0YLRgNCw0L3RgdGC0LLQsCDQstC+0L7QsdGA0LDQttC10L3QuNGPLiZuYnNwOzxkaXY+PGJyPjwv ZGl2PjxkaXY+0JfQsNGC0LXQvCDQvdCwI';
var utf8encoded = (new Buffer(base64encoded, 'base64')).toString('utf8');
new Buffer(...)
has been deprecated for a while now, go for Buffer.from(...)
a simple example might be:
var utf8encoded = Buffer.from(base64encoded, 'base64').toString('utf8');