File:setBuffer
Sets the buffer mode for a file opened for writing or appending. Files with buffering enabled will not write data to the disk until the buffer size limit is reached, depending on the buffer mode.

File:flush will force any buffered data to be written to the disk.
success, errorstr = File:setBuffer( mode, size )
mode BufferMode The buffer mode to use.
size (0) number The maximum size in bytes of the file's buffer.
success boolean Whether the buffer mode was successfully set.
errorstr string The error string, if the buffer mode could not be set and an error occurred.