README fixes

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-07 15:24:58 -05:00
parent 2f17d82126
commit b3c5524e26
1 changed files with 4 additions and 4 deletions

View File

@ -953,8 +953,8 @@ to stop watching a file or directory after calling `fs.watch()`.
The only supported option is `recursive`, which if `true` will cause a watch to be placed The only supported option is `recursive`, which if `true` will cause a watch to be placed
on a directory, and all sub-directories and files beneath it. on a directory, and all sub-directories and files beneath it.
The `listener` callback gets two arguments (event, filename). `event` is either 'rename' or 'change', The `listener` callback gets two arguments `(event, filename)`. `event` is either `'rename'` or `'change'`,
(currenty only `'rename'` is supported) and filename is the name of the file which triggered the event. (currenty only `'rename'` is supported) and `filename` is the name of the file/dir which triggered the event.
Unlike node.js, all watch events return a path. Also, all returned paths are absolute from the root Unlike node.js, all watch events return a path. Also, all returned paths are absolute from the root
vs. just a relative filename. vs. just a relative filename.
@ -964,7 +964,7 @@ Examples:
```javascript ```javascript
// Example 1: create a watcher to see when a file is created // Example 1: create a watcher to see when a file is created
var watcher = fs.watch('/myfile', function(event, filename) { var watcher = fs.watch('/myfile', function(event, filename) {
// event will be 'change' and filename will be '/myfile' // event could be 'change' or 'rename' and filename will be '/myfile'
// Stop watching for changes // Stop watching for changes
watcher.close(); watcher.close();
}); });
@ -981,7 +981,7 @@ fs.writeFile('/myfile2', 'data2');
// Example 3: recursive watch on /data dir // Example 3: recursive watch on /data dir
var watcher = fs.watch('/data', { recursive: true }, function(event, filename) { var watcher = fs.watch('/data', { recursive: true }, function(event, filename) {
// event will be 'change' and filename will be '/data/subdir/file' // event could be 'change' or 'rename' and filename will be '/data/subdir/file'
// Stop watching for changes // Stop watching for changes
watcher.close(); watcher.close();
}); });