Transactionally writing files in Node.js
I have a Node.js application that stores some configuration data in a file. If you change some settings, the configuration file is written to disk. At the moment, I am using a simple fs.writeFile . Now my question is: What happens when Node.js crashes while the file is being written? Is there the chance to have a corrupt file on disk? Or does Node.js guarantee that the file is written in an atomic way, so that either the old or the new version is valid? If not, how could I implement such a guarantee? Are there any modules for this? What happens when Node.js crashes while the file is being