Question : nodejs create buffer from string
Answered by : poor-pollan-dp7qccfrfmyn
// a string
const str = "Hey. this is a string!";
// convert string to Buffer
const buff = Buffer.from(str, "utf-8");
console.log(buff); // <Buffer 48 65 79 2e ... 72 69 6e 67 21>
Source : https://melvingeorge.me/blog/convert-string-buffer-nodejs | Last Update : Fri, 07 Jan 22
Question : convert string to buffer javascript
Answered by : dspoof-q
// If you can use Node.js you can use the from() method
const str = "Hey. this is a string!";
const buff = Buffer.from(str, "utf-8");
console.log(buff);
Source : https://melvingeorge.me/blog/convert-string-buffer-nodejs | Last Update : Fri, 19 Aug 22