Browse Source

doc: fs: clarfify fs.watch() documentation

fs.watch() is implemented on all supported platforms but, depending on the
object being watched, doesn't always work reliably (or at all).

Fixes #4005.
v0.8.11-release
Ben Noordhuis 12 years ago
parent
commit
58a5bc1ec7
  1. 13
      doc/api/fs.markdown

13
doc/api/fs.markdown

@ -437,7 +437,7 @@ The synchronous version of `fs.appendFile`.
## fs.watchFile(filename, [options], listener) ## fs.watchFile(filename, [options], listener)
Stability: 2 - Unstable. Use fs.watch instead, if available. Stability: 2 - Unstable. Use fs.watch instead, if possible.
Watch for changes on `filename`. The callback `listener` will be called each Watch for changes on `filename`. The callback `listener` will be called each
time the file is accessed. time the file is accessed.
@ -474,7 +474,7 @@ no-op, not an error.
## fs.watch(filename, [options], [listener]) ## fs.watch(filename, [options], [listener])
Stability: 2 - Unstable. Not available on all platforms. Stability: 2 - Unstable.
Watch for changes on `filename`, where `filename` is either a file or a Watch for changes on `filename`, where `filename` is either a file or a
directory. The returned object is a [fs.FSWatcher](#fs_class_fs_fswatcher). directory. The returned object is a [fs.FSWatcher](#fs_class_fs_fswatcher).
@ -508,9 +508,12 @@ to be notified of filesystem changes.
* On Windows systems, this feature depends on `ReadDirectoryChangesW`. * On Windows systems, this feature depends on `ReadDirectoryChangesW`.
If the underlying functionality is not available for some reason, then If the underlying functionality is not available for some reason, then
`fs.watch` will not be able to function. You can still use `fs.watch` will not be able to function. For example, watching files or
`fs.watchFile`, which uses stat polling, but it is slower and less directories on network file systems (NFS, SMB, etc.) often doesn't work
reliable. reliably or at all.
You can still use `fs.watchFile`, which uses stat polling, but it is slower and
less reliable.
#### Filename Argument #### Filename Argument

Loading…
Cancel
Save