Buffer.write(string, offset, length, encoding)
const buffer = Buffer.alloc(12); // allocate a buffer of size 12 buffer.write("Hello World!"); // write the string to the buffer console.log(buffer); // output:In this example, we first allocate a buffer of size 12 using `Buffer.alloc()`. Then we use the `write()` method to write the string "Hello World!" to the buffer. Finally, we log the contents of the buffer to the console. The package library used in this example is the built-in Node.js `buffer` module.