// 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>