Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Impove fs.WatchFile doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 7, 2011
1 parent e6ede31 commit bf8f4aa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/api/fs.markdown
Expand Up @@ -306,11 +306,11 @@ The synchronous version of `fs.writeFile`.
### fs.watchFile(filename, [options], listener)

Watch for changes on `filename`. The callback `listener` will be called each
time the file changes.
time the file is accessed.

The second argument is optional. The `options` if provided should be an object
containing two members a boolean, `persistent`, and `interval`, a polling
value in milliseconds. The default is `{persistent: true, interval: 0}`.
value in milliseconds. The default is `{ persistent: true, interval: 0 }`.

The `listener` gets two arguments the current stat object and the previous
stat object:
Expand All @@ -322,6 +322,10 @@ stat object:

These stat objects are instances of `fs.Stat`.

If you want to be notified when the file was modified, not just accessed
you need to compare `curr.mtime` and `prev.mtime.


### fs.unwatchFile(filename)

Stop watching for changes on `filename`.
Expand Down

0 comments on commit bf8f4aa

Please sign in to comment.