I\'m writing a large file with node.js using a writable stream:
var fs = require(\'fs\');
var stream = fs.createWriteStream(\'someFile.txt\', { flags : \
[Edit] The updated Node.js writable.write(...) API docs say:
[The] return value is strictly advisory. You MAY continue to write, even if it returns false. However, writes will be buffered in memory, so it is best not to do this excessively. Instead, wait for the drain event before writing more data.
[Original] From the stream.write(...) documentation (emphasis mine):
Returns
trueif the string has been flushed to the kernel buffer. Returnsfalseto indicate that the kernel buffer is full, and the data will be sent out in the future.
I interpret this to mean that the "write" function returns true if the given string was immediately written to the underlying OS buffer or false if it was not yet written but will be written by the write function (e.g. was presumably buffered for you by the WriteStream) so that you do not have to call "write" again.