Skip to content
This repository has been archived by the owner on Aug 31, 2018. It is now read-only.

Commit

Permalink
doc: added note to fs.watchFile on previousStat
Browse files Browse the repository at this point in the history
Explains the expected behavior of previousStat in fs.watchFile() when
a watched file disappears and reappears.

PR-URL: nodejs/node#16099
Fixes: nodejs/node#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>
  • Loading branch information
nikniv authored and addaleax committed Oct 15, 2017
1 parent 5faef59 commit 2774381
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2566,6 +2566,15 @@ v0.10.
`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
Expand Down

0 comments on commit 2774381

Please sign in to comment.