.writer() on a BunFile to retrieve a FileSink instance. It buffers data; call .flush() to write the buffer to disk. You can write & flush many times.
The
.write() method accepts strings or binary data.
The
FileSink also auto-flushes when its internal buffer is full. You can configure the buffer size with the highWaterMark option.
When you’re done writing, call
.end() to flush the buffer and close the file.
Full documentation: FileSink.