Socket
Socket
Sign inDemoInstall

watch

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.0 to 0.11.0

16

main.js

@@ -30,3 +30,6 @@ // Copyright 2010-2011 Mikeal Rogers

fs.readdir(dir, function (err, files) {
if (err) return callback(err);
if (err) {
if(err.code === 'EACCES' && options.ignoreUnreadableDir) return callback();
return callback(err);
}
callback.pending -= 1;

@@ -65,2 +68,5 @@ files.forEach(function (f, index) {

}
var watchedFiles = Object.create(null);
exports.watchTree = function ( root, options, callback ) {

@@ -102,2 +108,3 @@ if (!callback) {callback = options; options = {}}

}
watchedFiles[root] = files;
callback(files, null, null);

@@ -107,5 +114,12 @@ })

exports.unwatchTree = function (root) {
if (!watchedFiles[root]) return;
Object.keys(watchedFiles[root]).forEach(fs.unwatchFile);
watchedFiles[root] = false;
};
exports.createMonitor = function (root, options, cb) {
if (!cb) {cb = options; options = {}}
var monitor = new events.EventEmitter();
monitor.stop = exports.unwatchTree.bind(null, root);

@@ -112,0 +126,0 @@ var prevFile = {file: null,action: null,stat: null};

2

package.json

@@ -10,3 +10,3 @@ {

],
"version": "0.10.0",
"version": "0.11.0",
"homepage": "https://github.com/mikeal/watch",

@@ -13,0 +13,0 @@ "bugs": {

@@ -17,5 +17,8 @@ var fs = require('fs')

assert(isDirOrQ(name, stat));
fs.unwatchFile(name);
});
// If the process never exits then `unwatchTree` failed to unwatch all
// the files.
watch.unwatchTree(__dirname);
}
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc