summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorNiveditN <niveditn@gmail.com>2017-10-09 12:49:07 +0530
committerMyles Borins <mylesborins@google.com>2017-11-28 13:10:26 +0900
commit8c070f9ed5dca4e402c69eb0c4901a1c28b99ec7 (patch)
tree10b890705bba89fbd7d741750adccb092e127aa6 /doc
parent229a1fa2990e0c7bb51e231b90a08e741c8d73f5 (diff)
downloadnode-new-8c070f9ed5dca4e402c69eb0c4901a1c28b99ec7.tar.gz
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/fs.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 08fbf62b93..e61d1d11ea 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -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