1
2const b64string = /* whatever */;
3const buf = Buffer.from(b64string, 'base64');
4
1'use strict';
2
3let data = 'stackabuse.com';
4let buff = new Buffer(data);
5let base64data = buff.toString('base64');
6
7console.log('"' + data + '" converted to Base64 is "' + base64data + '"');
8