Comparing version 0.3.1 to 0.3.2
@@ -54,6 +54,7 @@ // Copyright 2010-2011 Mikeal Rogers | ||
walk(root, function (err, files) { | ||
if (err) throw err; | ||
var fileWatcher = function (f) { | ||
fs.watchFile(f, options, function (c, p) { | ||
// Check if anything actually changed in stat | ||
if (files[f] && !files[f].isDirectory() && c.nlink !== 0 && files[f].ino == c.ino) return; | ||
if (files[f] && !files[f].isDirectory() && c.nlink !== 0 && files[f].mtime == c.mtime) return; | ||
files[f] = c; | ||
@@ -109,2 +110,2 @@ if (!files[f].isDirectory()) callback(f, c, p); | ||
exports.walk = walk; | ||
exports.walk = walk; |
{ "name" : "watch" | ||
, "description" : "Utilities for watching file trees." | ||
, "tags" : ["util", "utility", "fs", "files"] | ||
, "version" : "0.3.1" | ||
, "version" : "0.3.2" | ||
, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>" | ||
@@ -6,0 +6,0 @@ , "directories" : |
var watch = require('../main') | ||
, assert = require('assert') | ||
, path = require('path') | ||
, fs = require('fs') | ||
, target = path.join(__dirname, "d/t") | ||
; | ||
watch.createMonitor(__dirname, function (monitor) { | ||
monitor.on('created', function (f) { | ||
console.log('created '+f) | ||
}) | ||
monitor.on('removed', function (f) { | ||
console.log('removed '+f) | ||
}) | ||
monitor.on('changed', function (f) { | ||
console.log('changed '+f) | ||
}) | ||
}); | ||
function clearFile() { | ||
fs.writeFileSync(target, '') | ||
} | ||
clearFile() | ||
// test if changed event is fired correctly | ||
watch.createMonitor(__dirname, { interval: 150 }, | ||
function (monitor) { | ||
monitor.once('changed', function (f) { | ||
assert.equal(f, target); | ||
clearFile(); | ||
process.exit(0) | ||
}) | ||
fs.writeFile(target, 'Test Write\n', function (err) { | ||
if (err) throw err; | ||
setTimeout(function () { | ||
// should have got the other assert done by now | ||
assert.ok(false); | ||
}, 300); | ||
}) | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16794
137
0
8
3