node:fs module, which includes the fs.appendFile and fs.appendFileSync functions for appending content to files.
You can use
fs.appendFile to asynchronously append data to a file, creating the file if it does not yet exist. The content can be a string or a Buffer.
To use the non-
Promise API:
To specify the encoding of the content:
To append the data synchronously, use
fs.appendFileSync:
See the Node.js documentation for more information.