base64 buffer js code example
Example 1: convert buffer to base64 javascript
var buffer = Buffer.from('hello');//create a buffer of the text "hello"
//right now, buffer == <Buffer 68 65 6c 6c 6f>
var string64 = buffer.toString('base64');
//the .toString operator can set encoding
//string64 == 'aGVsbG8='
Example 2: buffer from base64
const b64string = /* whatever */;
const buf = Buffer.from(b64string, 'base64');