Hacker News new | ask | show | jobs
by colanderman 3683 days 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

1 comments

Or 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.