2 ms·
The funny thing is, this doesn't even call fsync(2) (which is available in Node [1]). So the file contents will likely actually remain on disk for some seconds
by colanderman 10y ago
The funny thing is, this doesn't even call fsync(2) (which is available in Node [1]). So the file contents will likely actually remain on disk for some seconds to minutes thereafter, depending on the OS, file system, and their configuration.
[1] https://nodejs.org/api/fs.html#fs_fs_fsync_fd_callback https://nodejs.org/api/fs.html#fs_fs_fsync_fd_callback
- qb45 10y agoOr years if the OS crashes afterwards. I also wonder what happens if the file is deleted before the zeros are flushed. Is there some implicit flush, triggered by metadata changes, which saves the day? No idea.