+2
-2
@@ -39,8 +39,8 @@ var filewatcher = require('filewatcher') | ||
| stats[filepath] = null | ||
| yolo.emit('deleted', filepath, stat) | ||
| yolo.emit('deleted', filepath) | ||
| } else { | ||
| stats[filepath].stat = stat | ||
| yolo.emit('changed', filepath, stat) | ||
| yolo.emit('changed', filepath, stats[filepath]) | ||
| } | ||
| } | ||
| } |
+1
-1
| { | ||
| "name": "yolowatch", | ||
| "version": "2.1.0", | ||
| "version": "2.2.0", | ||
| "description": "watch filesystem changes yolostyle", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+20
-6
@@ -18,18 +18,32 @@ # yolowatch | ||
| watcher.on('changed', function (file) { | ||
| console.log(file.filepath, 'was changed') | ||
| console.log('is a', file.type) //'file', 'directory' | ||
| watcher.on('changed', function (file, data) { | ||
| console.log(file, 'was changed') | ||
| console.log('is a', data.type) //'file', 'directory' | ||
| }) | ||
| watcher.on('deleted', function (file) { | ||
| console.log(file.filepath, 'was deleted') | ||
| console.log(file, 'was deleted') | ||
| }) | ||
| watcher.on('added', function (file) { | ||
| console.log(file.filepath, 'was deleted') | ||
| watcher.on('added', function (file, data) { | ||
| console.log(file, 'was added') | ||
| }) | ||
| ``` | ||
| Example `data` in callback (see folder-walker): | ||
| ``` | ||
| { | ||
| basename: 'index.js', | ||
| relname: 'test/index.js', | ||
| root: '/Users/karissa/dev/node_modules/folder-walker', | ||
| filepath: '/Users/karissa/dev/node_modules/folder-walker/test/index.js', | ||
| stat: [fs.Stat Object], | ||
| type: 'file' // or 'directory' | ||
| } | ||
| ``` | ||
| ### Todo | ||
| * expose options to pass to filewatcher module | ||
| * function to remove directory & children from being watched. |
+3
-3
@@ -25,7 +25,7 @@ var fs = require('fs') | ||
| test('file is updated', function (t) { | ||
| watcher.on('changed', function (file, stat) { | ||
| watcher.on('changed', function (file, data) { | ||
| t.plan(2) | ||
| if (file !== fStart) return false | ||
| t.equal(file, fStart) | ||
| t.ok(stat.mtime > 0, 'mtime > 0') | ||
| t.ok(data.stat.mtime > 0, 'mtime > 0') | ||
| }) | ||
@@ -38,3 +38,3 @@ touch(fStart) | ||
| f = createFile() | ||
| watcher.on('added', function (file, stat) { | ||
| watcher.on('added', function (file, data) { | ||
| if (file !== f) return false | ||
@@ -41,0 +41,0 @@ t.equal(file, f) |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
3723
10.7%49
40%0
-100%