node string to buffer code example
Example 1: javascript string to buffer
var buf = Buffer.from('abc');
console.log(buf.toString());
Example 2: nodejs array buffer to buffer
"From ArrayBuffer to Buffer" could be done this way:
var buffer = Buffer.from( new Uint8Array(ab) );