In the documentation for the Node.js fs
module, under "File System flags", it says:
'w' - Open file for writing. The file is created (if it does not exist) or truncated (if it exists).
Truncated to what size? 0 bytes?
Yes, the 'w' flag will truncate the file to 0 bytes before writing -- effectively overwriting the file if it exists. (As opposed to the 'a' flag, which will append to the end of an existing file.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With