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

pathwatcher

Package Overview
Dependencies
Maintainers
6
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pathwatcher - npm Package Compare versions

Comparing version 4.4.3 to 5.0.0

114

api.json

@@ -6,3 +6,3 @@ {

"filename": "src/directory.coffee",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L14",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L13",
"sections": [

@@ -35,3 +35,3 @@ {

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L27",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L26",
"visibility": "Public",

@@ -58,3 +58,3 @@ "summary": "Configures a new Directory instance, no files are accessed.",

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L51",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L50",
"visibility": "Public",

@@ -75,3 +75,3 @@ "summary": "Creates the directory on disk that corresponds to `::getPath()` if\nno such directory already exists.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L73",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L72",
"visibility": "Public",

@@ -98,3 +98,3 @@ "summary": "Invoke the given callback when the directory's contents change.",

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L95",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L94",
"visibility": "Public",

@@ -113,3 +113,3 @@ "summary": "",

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L98",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L97",
"visibility": "Public",

@@ -126,5 +126,19 @@ "summary": "",

{
"name": "isSymbolicLink",
"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L100",
"visibility": "Public",
"summary": "",
"description": "",
"returnValues": [
{
"type": "Boolean",
"description": "Returns a {Boolean} indicating whether or not this is a symbolic link"
}
]
},
{
"name": "exists",
"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L102",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L105",
"visibility": "Public",

@@ -143,3 +157,3 @@ "summary": "",

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L107",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L109",
"visibility": "Public",

@@ -158,3 +172,3 @@ "summary": "",

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L112",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L114",
"visibility": "Public",

@@ -167,3 +181,3 @@ "summary": "Return a {Boolean}, true if this {Directory} is the root directory\nof the filesystem, or false if it isn't. ",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L123",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L125",
"visibility": "Public",

@@ -182,3 +196,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L129",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L131",
"visibility": "Public",

@@ -197,3 +211,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L140",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L142",
"visibility": "Public",

@@ -212,3 +226,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L145",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L147",
"visibility": "Public",

@@ -227,3 +241,3 @@ "summary": "",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L202",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L204",
"visibility": "Public",

@@ -242,3 +256,3 @@ "summary": "Traverse to the parent directory.",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L211",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L213",
"visibility": "Public",

@@ -265,3 +279,3 @@ "summary": "Traverse within this Directory to a child File. This method doesn't\nactually check to see if the File exists, it just creates the File object.",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L221",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L223",
"visibility": "Public",

@@ -288,3 +302,3 @@ "summary": "Traverse within this a Directory to a child Directory. This method\ndoesn't actually check to see if the Directory exists, it just creates the\nDirectory object.",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L227",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L229",
"visibility": "Public",

@@ -303,3 +317,3 @@ "summary": "Reads file entries in this directory from disk synchronously.",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L248",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L250",
"visibility": "Public",

@@ -334,3 +348,3 @@ "summary": "Reads file entries in this directory from disk asynchronously.",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/directory.coffee#L279",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/directory.coffee#L281",
"visibility": "Public",

@@ -364,3 +378,3 @@ "summary": "Determines if the given path (real or symbolic) is inside this\ndirectory. This method does not actually check if the path exists, it just\nchecks if the path is under this directory.",

"filename": "src/file.coffee",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L19",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L18",
"sections": [

@@ -397,3 +411,3 @@ {

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L32",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L31",
"visibility": "Public",

@@ -420,3 +434,3 @@ "summary": "Configures a new File instance, no files are accessed.",

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L54",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L53",
"visibility": "Public",

@@ -435,3 +449,3 @@ "summary": "Creates the file on disk that corresponds to `::getPath()` if no\nsuch file already exists.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L72",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L71",
"visibility": "Public",

@@ -458,3 +472,3 @@ "summary": "Invoke the given callback when the file's contents change.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L81",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L80",
"visibility": "Public",

@@ -481,3 +495,3 @@ "summary": "Invoke the given callback when the file's path changes.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L90",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L89",
"visibility": "Public",

@@ -504,3 +518,3 @@ "summary": "Invoke the given callback when the file is deleted.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L103",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L102",
"visibility": "Public",

@@ -543,3 +557,3 @@ "summary": "Invoke the given callback when there is an error with the watch.\nWhen your callback has been invoked, the file will have unsubscribed from\nthe file watches.",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L125",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L124",
"visibility": "Public",

@@ -558,3 +572,3 @@ "summary": "",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L128",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L127",
"visibility": "Public",

@@ -571,5 +585,19 @@ "summary": "",

{
"name": "isSymbolicLink",
"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L130",
"visibility": "Public",
"summary": "",
"description": "",
"returnValues": [
{
"type": "Boolean",
"description": "Returns a {Boolean} indicating whether or not this is a symbolic link"
}
]
},
{
"name": "exists",
"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L132",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L135",
"visibility": "Public",

@@ -588,3 +616,3 @@ "summary": "",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L137",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L140",
"visibility": "Public",

@@ -603,3 +631,3 @@ "summary": "",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L143",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L146",
"visibility": "Public",

@@ -618,3 +646,3 @@ "summary": "Get the SHA-1 digest of this file",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L152",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L155",
"visibility": "Public",

@@ -633,3 +661,3 @@ "summary": "Get the SHA-1 digest of this file",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L162",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L165",
"visibility": "Public",

@@ -650,3 +678,3 @@ "summary": "Sets the file's character set encoding name.",

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L173",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L176",
"visibility": "Public",

@@ -665,3 +693,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L180",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L183",
"visibility": "Public",

@@ -680,3 +708,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L187",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L190",
"visibility": "Public",

@@ -695,3 +723,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L196",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L199",
"visibility": "Public",

@@ -710,3 +738,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L204",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L211",
"visibility": "Public",

@@ -719,3 +747,3 @@ "summary": "Return the {String} filename without any directory information. ",

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L212",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L219",
"visibility": "Public",

@@ -728,3 +756,3 @@ "summary": "Return the {Directory} that contains this file. ",

"sectionName": "Reading and Writing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L248",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L255",
"visibility": "Public",

@@ -744,3 +772,3 @@ "summary": "Reads the contents of the file.",

"type": null,
"description": "Returns a promise that resovles to a String."
"description": "Returns a promise that resolves to a String."
}

@@ -752,3 +780,3 @@ ]

"sectionName": "Reading and Writing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L286",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L289",
"visibility": "Public",

@@ -775,3 +803,3 @@ "summary": "Overwrites the file with the given text.",

"sectionName": "Reading and Writing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.4.3/src/file.coffee#L298",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v5.0.0/src/file.coffee#L301",
"visibility": "Public",

@@ -778,0 +806,0 @@ "summary": "Overwrites the file with the given text.",

(function() {
var Directory, Disposable, Emitter, EmitterMixin, File, Grim, PathWatcher, Q, async, fs, path, _ref,
var Directory, Disposable, Emitter, EmitterMixin, File, Grim, PathWatcher, async, fs, path, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -16,4 +16,2 @@ __slice = [].slice;

Q = require('q');
File = require('./file');

@@ -70,3 +68,3 @@

return _this.getParent().create().then(function() {
return Q.Promise(function(resolve, reject) {
return new Promise(function(resolve, reject) {
return fs.mkdir(_this.getPath(), mode, function(error) {

@@ -131,5 +129,9 @@ if (error) {

Directory.prototype.isSymbolicLink = function() {
return this.symlink;
};
Directory.prototype.exists = function() {
return Q.Promise((function(_this) {
return function(resolve, reject) {
return new Promise((function(_this) {
return function(resolve) {
return fs.exists(_this.getPath(), resolve);

@@ -136,0 +138,0 @@ };

(function() {
var Directory, Disposable, Emitter, EmitterMixin, File, Grim, PathWatcher, Q, crypto, fs, iconv, path, runas, _, _ref,
var Directory, Disposable, Emitter, EmitterMixin, File, Grim, PathWatcher, crypto, fs, iconv, path, runas, _, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

@@ -18,4 +18,2 @@ __slice = [].slice;

Q = require('q');
runas = null;

@@ -140,5 +138,9 @@

File.prototype.isSymbolicLink = function() {
return this.symlink;
};
File.prototype.exists = function() {
return Q.Promise((function(_this) {
return function(resolve, reject) {
return new Promise((function(_this) {
return function(resolve) {
return fs.exists(_this.getPath(), resolve);

@@ -154,10 +156,11 @@ };

File.prototype.getDigest = function() {
if (this.digest) {
return Q(this.digest);
if (this.digest != null) {
return Promise.resolve(this.digest);
} else {
return this.read().then((function(_this) {
return function() {
return _this.digest;
};
})(this));
}
return this.read().then((function(_this) {
return function(contents) {
return _this.digest;
};
})(this));
};

@@ -222,7 +225,13 @@

if (this.realPath != null) {
return Q(this.realPath);
return Promise.resolve(this.realPath);
} else {
return Q.nfcall(fs.realpath, this.path).then((function(_this) {
return function(realPath) {
return _this.realPath = realPath;
return new Promise((function(_this) {
return function(resolve, reject) {
return fs.realpath(_this.path, function(err, result) {
if (err != null) {
return reject(err);
} else {
return resolve(_this.realPath = result);
}
});
};

@@ -289,36 +298,36 @@ })(this));

File.prototype.read = function(flushCache) {
var bytesRead, content, deferred, encoding, promise, readStream;
var promise;
if ((this.cachedContents != null) && !flushCache) {
promise = Q(this.cachedContents);
promise = Promise.resolve(this.cachedContents);
} else {
deferred = Q.defer();
promise = deferred.promise;
content = [];
bytesRead = 0;
encoding = this.getEncoding();
if (encoding === 'utf8') {
readStream = fs.createReadStream(this.getPath(), {
encoding: encoding
});
} else {
if (iconv == null) {
iconv = require('iconv-lite');
}
readStream = fs.createReadStream(this.getPath()).pipe(iconv.decodeStream(encoding));
}
readStream.on('data', function(chunk) {
content.push(chunk);
bytesRead += chunk.length;
return deferred.notify(bytesRead);
});
readStream.on('end', function() {
return deferred.resolve(content.join(''));
});
readStream.on('error', function(error) {
if (error.code === 'ENOENT') {
return deferred.resolve(null);
} else {
return deferred.reject(error);
}
});
promise = new Promise((function(_this) {
return function(resolve, reject) {
var content, encoding, readStream;
content = [];
encoding = _this.getEncoding();
if (encoding === 'utf8') {
readStream = fs.createReadStream(_this.getPath(), {
encoding: encoding
});
} else {
if (iconv == null) {
iconv = require('iconv-lite');
}
readStream = fs.createReadStream(_this.getPath()).pipe(iconv.decodeStream(encoding));
}
readStream.on('data', function(chunk) {
return content.push(chunk);
});
readStream.on('end', function() {
return resolve(content.join(''));
});
return readStream.on('error', function(error) {
if (error.code === 'ENOENT') {
return resolve(null);
} else {
return reject(error);
}
});
};
})(this));
}

@@ -362,4 +371,12 @@ return promise.then((function(_this) {

if (encoding === 'utf8') {
return Q.nfcall(fs.writeFile, filePath, contents, {
encoding: encoding
return new Promise(function(resolve, reject) {
return fs.writeFile(filePath, contents, {
encoding: encoding
}, function(err, result) {
if (err != null) {
return reject(err);
} else {
return resolve(result);
}
});
});

@@ -370,3 +387,11 @@ } else {

}
return Q.nfcall(fs.writeFile, filePath, iconv.encode(contents, encoding));
return new Promise(function(resolve, reject) {
return fs.writeFile(filePath, iconv.encode(contents, encoding), function(err, result) {
if (err != null) {
return reject(err);
} else {
return resolve(result);
}
});
});
}

@@ -403,3 +428,3 @@ };

File.prototype.handleNativeChangeEvent = function(eventType, eventPath) {
var error, handleReadError, oldContents;
var error, handleReadError, handleResolve, oldContents;
switch (eventType) {

@@ -441,3 +466,3 @@ case 'delete':

try {
return this.read(true)["catch"](handleReadError).done((function(_this) {
handleResolve = (function(_this) {
return function(newContents) {

@@ -451,3 +476,4 @@ if (oldContents !== newContents) {

};
})(this));
})(this);
return this.read(true).then(handleResolve, handleReadError);
} catch (_error) {

@@ -454,0 +480,0 @@ error = _error;

@@ -5,3 +5,3 @@ {

"description": "Watch files and directories for changes",
"version": "4.4.3",
"version": "5.0.0",
"licenses": [

@@ -45,3 +45,2 @@ {

"nan": "https://atom.io/download/atom-shell/nan-1.6.1.tgz",
"q": "^1.1.2",
"runas": "^2.0.0",

@@ -48,0 +47,0 @@ "underscore-plus": "~1.x"

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