mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
doc: added note to fs.watchFile on previousStat
Explains the expected behavior of previousStat in fs.watchFile() when a watched file disappears and reappears. PR-URL: https://github.com/nodejs/node/pull/16099 Fixes: https://github.com/nodejs/node/issues/15364 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
1 parent
229a1fa299
commit
8c070f9ed5
1 file changed
+9
@@ -1925,6 +1925,15 @@ you need to compare `curr.mtime` and `prev.mtime`.
|
||||
`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and
|
||||
`fs.unwatchFile` when possible.
|
||||
|
||||
*Note:* When a file being watched by `fs.watchFile()` disappears and reappears,
|
||||
then the `previousStat` reported in the second callback event (the file's
|
||||
reappearance) will be the same as the `previousStat` of the first callback
|
||||
event (its disappearance).
|
||||
|
||||
This happens when:
|
||||
- the file is deleted, followed by a restore
|
||||
- the file is renamed twice - the second time back to its original name
|
||||
|
||||
## fs.write(fd, buffer[, offset[, length[, position]]], callback)
|
||||
<!-- YAML
|
||||
added: v0.0.2
|
||||
|
||||
Reference in new issue
Block a user