From 06d71ad45769dfcd28b4fcc8ed62fa5c604d8cc8 Mon Sep 17 00:00:00 2001 From: Trevor Burnham Date: Wed, 16 Nov 2011 18:19:46 -0500 Subject: [PATCH] docs: document the `persistent` option for `fs.watch` and `fs.watchFile` --- doc/api/fs.markdown | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown index fd84f82..76ae6a2 100644 --- a/doc/api/fs.markdown +++ b/doc/api/fs.markdown @@ -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]) @@ -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: @@ -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 -- 2.7.4