How does one write to a file after a certain amount of data is received?
I know the file can be opened and then it can be written to using file:pwrite(Position, Bin).
The thing I would like to know is if data is e.g. being downloaded and needs to be written to the file. How does one do this efficiently? e.g. using a buffer(how is a buffer written?)
Also Is the file kept open the entire time until the download is done or is it opened each time the buffer is reached and the data needs to be written?
Thanks