node-watch
Advanced tools
+5
-6
@@ -143,10 +143,9 @@ /** | ||
| // Due to the unstalbe fs.watch(), swtiches to watch its parent | ||
| // directory when watching a single file, instead of watch it | ||
| // directly. And then triggers the callback function whenever the | ||
| // logged filename matches it. | ||
| // Due to the unstalbe fs.watch(), if the `fpath` is a file then | ||
| // switch to watch its parent directory instead of watch it directly. | ||
| // Once the logged filename matches it then triggers the callback function. | ||
| if (is.File(fpath)) { | ||
| var parent = path.resolve(fpath, '..'); | ||
| fs.watch(parent, function(err, fname) { | ||
| if (path.basename(fpath) == fname) { | ||
| if (path.basename(fpath) === fname) { | ||
| normalizeCall(fpath, cb); | ||
@@ -170,2 +169,2 @@ } | ||
| module.exports = watch; | ||
+2
-2
| { | ||
| "name": "node-watch" | ||
| , "version": "0.2.3" | ||
| , "description": "NodeJS file.watch wrapper" | ||
| , "version": "0.2.4" | ||
| , "description": "fs.watch() wrapper of Nodejs " | ||
| , "url": "https://github.com/yuanchuan/node-watch" | ||
@@ -6,0 +6,0 @@ , "author": "yuanchuan <yuanchuan23@gmail.com> (http://yuanchuan.name)" |
+7
-5
| #Node-watch | ||
| This program is part of Markab(an instant mockup tool, still under development). | ||
| There are 3 problems when using the native fs.watch() function of Nodejs: | ||
| The difference bewteen other nodewatch tools is that it does not differentiate event like "rename" or "delete". Once there is a change, the callback function will be triggered. | ||
| 1. It won't watch a directory recursively. | ||
| 2. When modifying a file inside a watched directory, the callback function will be triggered multiple times. | ||
| 3. when modifying a watched file with an editor like vim, the callback function will only be triggered one time and then it is unwatched. | ||
| ##Feature | ||
| And this module is trying to solve those problems. | ||
| *Recursively watch a directory* | ||
| (In current version it does not differentiate event like "rename" or "delete". Once there is a change, the callback function will be triggered.) | ||
| ##Installation | ||
| ## Installation | ||
@@ -13,0 +15,0 @@ npm install node-watch |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
6034
4.2%25
8.7%146
-0.68%