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

Commit

Permalink
docs: document the persistent option for fs.watch and fs.watchFile
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorBurnham authored and bnoordhuis committed Nov 17, 2011
1 parent 9d3faf4 commit 06d71ad
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions doc/api/fs.markdown
Expand Up @@ -218,7 +218,7 @@ Synchronous rmdir(2).
### fs.mkdir(path, [mode], [callback])

Asynchronous mkdir(2). No arguments other than a possible exception are given
to the completion callback. `mode` defaults to `0777`.
to the completion callback. `mode` defaults to `0777`.

### fs.mkdirSync(path, [mode])

Expand Down Expand Up @@ -391,8 +391,11 @@ Watch for changes on `filename`. The callback `listener` will be called each
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 }`.
containing two members a boolean, `persistent`, and `interval`. `persistent`
indicates whether the process should continue to run as long as files are
being watched. `interval` indicates how often the target should be polled,
in milliseconds. (On Linux systems with inotify, `interval` is ignored.) The
default is `{ persistent: true, interval: 0 }`.

The `listener` gets two arguments the current stat object and the previous
stat object:
Expand All @@ -418,7 +421,9 @@ Watch for changes on `filename`, where `filename` is either a file or a
directory. The returned object is [fs.FSWatcher](#fs.FSWatcher).

The second argument is optional. The `options` if provided should be an object
containing a boolean member `persistent`. The default is `{ persistent: true }`.
containing a boolean member `persistent`, which indicates whether the process
should continue to run as long as files are being watched. The default is
`{ persistent: true }`.

The listener callback gets two arguments `(event, filename)`. `event` is either
'rename' or 'change', and `filename` is the name of the file which triggered
Expand Down

0 comments on commit 06d71ad

Please sign in to comment.