If the Node.js main process crash during the fs.writeFile operation, My questions are:
What will happen to the file?
Will the write action stop, and cause just do half write?
If the write flag is 'w', will the file store just half data?
How can I avoid this situation, and make sure I can store either no data or complete data? Maybe set the flag to 'a' is a solution. Any other better ideas?