Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

yolowatch

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yolowatch - npm Package Compare versions

Comparing version
2.1.0
to
2.2.0
+2
-2
index.js

@@ -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])
}
}
}
{
"name": "yolowatch",
"version": "2.1.0",
"version": "2.2.0",
"description": "watch filesystem changes yolostyle",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -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.

@@ -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)