Skip to content

Commit 06d71ad

Browse files
TrevorBurnhambnoordhuis
authored andcommitted
docs: document the persistent option for fs.watch and fs.watchFile
1 parent 9d3faf4 commit 06d71ad

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

doc/api/fs.markdown

+9-4
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Synchronous rmdir(2).
218218
### fs.mkdir(path, [mode], [callback])
219219

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

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

@@ -391,8 +391,11 @@ Watch for changes on `filename`. The callback `listener` will be called each
391391
time the file is accessed.
392392

393393
The second argument is optional. The `options` if provided should be an object
394-
containing two members a boolean, `persistent`, and `interval`, a polling
395-
value in milliseconds. The default is `{ persistent: true, interval: 0 }`.
394+
containing two members a boolean, `persistent`, and `interval`. `persistent`
395+
indicates whether the process should continue to run as long as files are
396+
being watched. `interval` indicates how often the target should be polled,
397+
in milliseconds. (On Linux systems with inotify, `interval` is ignored.) The
398+
default is `{ persistent: true, interval: 0 }`.
396399

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

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

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

0 commit comments

Comments
 (0)