1> console.log(Buffer.from("Hello World").toString('base64'));
2SGVsbG8gV29ybGQ=
3> console.log(Buffer.from("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'))
4Hello World
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