diff --git a/doc/api/fs.md b/doc/api/fs.md index 08fbf62b9363cf..e61d1d11ea12d5 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)