diff --git a/doc/api/fs.md b/doc/api/fs.md index 57af737a2f6444..f48f2e3b2ddf6a 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -598,6 +598,72 @@ added: v0.5.8 Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. +### `watcher.ref()` + + +* Returns: {fs.FSWatcher} + +When called, requests that the Node.js event loop *not* exit so long as the +`FSWatcher` is active. Calling `watcher.ref()` multiple times will have +no effect. + +By default, all `FSWatcher` objects are "ref'ed", making it normally +unnecessary to call `watcher.ref()` unless `watcher.unref()` had been +called previously. + +### `watcher.unref()` + + +* Returns: {fs.FSWatcher} + +When called, the active `FSWatcher` object will not require the Node.js +event loop to remain active. If there is no other activity keeping the +event loop running, the process may exit before the `FSWatcher` object's +callback is invoked. Calling `watcher.unref()` multiple times will have +no effect. + +## Class: `fs.StatWatcher` + + +* Extends {EventEmitter} + +A successful call to `fs.watchFile()` method will return a new `fs.StatWatcher` +object. + +### `watcher.ref()` + + +* Returns: {fs.StatWatcher} + +When called, requests that the Node.js event loop *not* exit so long as the +`StatWatcher` is active. Calling `watcher.ref()` multiple times will have +no effect. + +By default, all `StatWatcher` objects are "ref'ed", making it normally +unnecessary to call `watcher.ref()` unless `watcher.unref()` had been +called previously. + +### `watcher.unref()` + + +* Returns: {fs.StatWatcher} + +When called, the active `StatWatcher` object will not require the Node.js +event loop to remain active. If there is no other activity keeping the +event loop running, the process may exit before the `StatWatcher` object's +callback is invoked. Calling `watcher.unref()` multiple times will have +no effect. + ## Class: `fs.ReadStream`