+Note: With the default `flags`:`w` option, the `fs.createWriteStream()` function opens a file for writing. The file is created (if it does not exist) or truncated (if it exists). Since most browsers send more than one request to a server at a time, each new request, and therefore each new `fs.createWriteStream()` call deletes any existing data from the `output` file. So, to ensure that no possible subsequent requests remove data written by the `POST` request with the data from the `<form>` element, the `flags`:`a` option is added to the `fs.createWriteStream()` call, which then opens a file for appending data (any existing data remains unaffected).
0 commit comments