Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chokidar

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chokidar - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

3

CHANGELOG.md

@@ -0,1 +1,4 @@

# Chokidar 0.2.5 (June 8, 2012)
* Fixed a bug when new files in new directories hadn't been added.
# Chokidar 0.2.4 (June 7, 2012)

@@ -2,0 +5,0 @@ * Fixed a bug when unlinked files emitted events after unlink.

@@ -48,4 +48,5 @@ 'use strict';

FSWatcher.prototype._getWatchedDir = function(directory) {
if (this.watched[directory] == null) this.watched[directory] = [];
return this.watched[directory];
var dir = directory.replace(/[\\\/]$/, '');
if (this.watched[dir] == null) this.watched[dir] = [];
return this.watched[dir];
};

@@ -68,2 +69,29 @@

// Private: Handles emitting unlink events for
// files and directories, and via recursion, for
// files and directories within directories that are unlinked
//
// directory - string, directory within which the following item is located
// item - string, base path of item/directory
//
// Returns nothing.
FSWatcher.prototype._remove = function(directory, item) {
var _this = this;
// if what is being deleted is a directory, get that directory's paths
// for recursive deleting and cleaning of watched object
// if it is not a directory, nestedDirectoryChildren will be empty array
var fullPath = sysPath.join(directory, item);
var nestedDirectoryChildren = _this._getWatchedDir(fullPath).slice();
// Remove directory / file from watched list.
_this._removeFromWatchedDir(directory, item);
// Recursively remove children directories / files.
nestedDirectoryChildren.forEach(function(nestedItem) {
_this._remove(fullPath, nestedItem);
});
_this.emit('unlink', fullPath);
};
// Private: Watch file for changes with fs.watchFile or fs.watch.

@@ -79,7 +107,10 @@ //

if (callback == null) callback = function() {};
var parent = this._getWatchedDir(sysPath.dirname(item));
var directory = sysPath.dirname(item)
var basename = sysPath.basename(item);
var parent = this._getWatchedDir(directory);
// Prevent memory leaks.
if (parent.indexOf(basename) >= 0) return;
parent.push(basename);
_this._addToWatchedDir(directory, basename);
if (process.platform === 'win32') {

@@ -142,4 +173,3 @@ watcher = fs.watch(item, {

.forEach(function(file) {
_this._removeFromWatchedDir(directory, file);
_this.emit('unlink', sysPath.join(directory, file));
_this._remove(directory,file);
});

@@ -155,3 +185,2 @@

.forEach(function(file) {
_this._addToWatchedDir(directory, file);
_this._handle(sysPath.join(directory, file));

@@ -158,0 +187,0 @@ });

2

package.json
{
"name": "chokidar",
"description": "A neat wrapper around node.js fs.watch / fs.watchFile.",
"version": "0.2.4",
"version": "0.2.5",
"keywords": ["fs", "watch", "watchFile", "watcher", "file"],

@@ -6,0 +6,0 @@ "homepage": "https://github.com/paulmillr/chokidar",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc