how to convert string to buffer in javascript code example Example: javascript string to buffer var buf = Buffer.from('abc'); console.log(buf.toString());