Skip to content

Commit eb1856d

Browse files
TrottFishrock123
authored andcommitted
doc: clarify stability of fs.watch and relatives
Fixes: #1754 PR-URL: #1775 Reviewed-By: Brendan Ashworth <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 5abd4ac commit eb1856d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

doc/api/fs.markdown

+8-6
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,6 @@ The synchronous version of `fs.appendFile`.
534534

535535
## fs.watchFile(filename[, options], listener)
536536

537-
Stability: 2 - Unstable. Use fs.watch instead, if possible.
538-
539537
Watch for changes on `filename`. The callback `listener` will be called each
540538
time the file is accessed.
541539

@@ -558,9 +556,11 @@ These stat objects are instances of `fs.Stat`.
558556
If you want to be notified when the file was modified, not just accessed
559557
you need to compare `curr.mtime` and `prev.mtime`.
560558

561-
## fs.unwatchFile(filename[, listener])
559+
_Note: `fs.watch` is more efficient than `fs.watchFile` and `fs.unwatchFile`.
560+
`fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile`
561+
when possible._
562562

563-
Stability: 2 - Unstable. Use fs.watch instead, if possible.
563+
## fs.unwatchFile(filename[, listener])
564564

565565
Stop watching for changes on `filename`. If `listener` is specified, only that
566566
particular listener is removed. Otherwise, *all* listeners are removed and you
@@ -569,9 +569,11 @@ have effectively stopped watching `filename`.
569569
Calling `fs.unwatchFile()` with a filename that is not being watched is a
570570
no-op, not an error.
571571

572-
## fs.watch(filename[, options][, listener])
572+
_Note: `fs.watch` is more efficient than `fs.watchFile` and `fs.unwatchFile`.
573+
`fs.watch` should be used instead of `fs.watchFile` and `fs.unwatchFile`
574+
when possible._
573575

574-
Stability: 2 - Unstable.
576+
## fs.watch(filename[, options][, listener])
575577

576578
Watch for changes on `filename`, where `filename` is either a file or a
577579
directory. The returned object is a [fs.FSWatcher](#fs_class_fs_fswatcher).

0 commit comments

Comments
 (0)