In fact, it does not matter if you are accessing the file synchronously or asynchronously: if any other process (yours or someone else) modifies the file while you are in the middle of reading, you will get conflicting results.
The exact type of inconsistency you see depends on how the file is written and reading begins.
node mode (w), .
r+, . , . , .
, , (.. createReadStream), readFile readFileSync. , node . ( , writeFileSync, readFileSync , , . , .)
, . , , rename .
source
share