nodejs btoa code example
Example 1: nodejs btoa
Buffer.from('Hello world!', 'binary').toString('base64')
Example 2: atob nodejs
(function () {
"use strict";
var atob = require('atob');
var b64 = "SGVsbG8sIFdvcmxkIQ==";
var bin = atob(b64);
console.log(bin); // "Hello, World!"
}());
Example 3: rror: btoa is not defined
console.log(Buffer.from('Hello World!').toString('base64'));