Skip to main content
Bun implements the node:fs module, which includes the fs.appendFile and fs.appendFileSync functions for appending content to files.
fs.appendFile asynchronously appends 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 fs.appendFile.