New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.1.0 to 4.0.0

98

api.json

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

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

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

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L29",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L29",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L53",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L53",
"visibility": "Public",

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

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L81",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L81",
"visibility": "Public",

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

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L84",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L84",
"visibility": "Public",

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

"sectionName": "Directory Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L88",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L88",
"visibility": "Public",

@@ -120,3 +120,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/v3.1.0/src/directory.coffee#L99",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L99",
"visibility": "Public",

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

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L105",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L105",
"visibility": "Public",

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

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L116",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L116",
"visibility": "Public",

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

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L121",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L121",
"visibility": "Public",

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

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L178",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L178",
"visibility": "Public",

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

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L187",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L187",
"visibility": "Public",

@@ -218,3 +218,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/v3.1.0/src/directory.coffee#L197",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L197",
"visibility": "Public",

@@ -241,3 +241,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/v3.1.0/src/directory.coffee#L203",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L203",
"visibility": "Public",

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

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L224",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L224",
"visibility": "Public",

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

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/directory.coffee#L251",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/directory.coffee#L251",
"visibility": "Public",

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

"filename": "src/file.coffee",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L20",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L20",
"sections": [

@@ -342,3 +342,3 @@ {

"sectionName": "Construction",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L35",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L35",
"visibility": "Public",

@@ -365,3 +365,3 @@ "summary": "Creates a new file.",

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L74",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L69",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L83",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L78",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L92",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L87",
"visibility": "Public",

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

"sectionName": "Event Subscription",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L105",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L100",
"visibility": "Public",

@@ -473,3 +473,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/v3.1.0/src/file.coffee#L126",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L122",
"visibility": "Public",

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

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

@@ -501,5 +501,5 @@ "summary": "",

{
"name": "exists",
"name": "existsSync",
"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L132",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L133",
"visibility": "Public",

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

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L138",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L139",
"visibility": "Public",

@@ -526,2 +526,16 @@ "summary": "Get the SHA-1 digest of this file",

"type": "String",
"description": "Returns a promise that resolves to a {String}."
}
]
},
{
"name": "getDigestSync",
"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L148",
"visibility": "Public",
"summary": "Get the SHA-1 digest of this file",
"description": "Get the SHA-1 digest of this file",
"returnValues": [
{
"type": "String",
"description": "Returns a {String}."

@@ -534,3 +548,3 @@ }

"sectionName": "File Metadata",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L147",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L159",
"visibility": "Public",

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

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

@@ -566,3 +580,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L157",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L169",
"visibility": "Public",

@@ -581,3 +595,3 @@ "summary": "",

"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L164",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L176",
"visibility": "Public",

@@ -594,5 +608,19 @@ "summary": "",

{
"name": "getRealPath",
"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L186",
"visibility": "Public",
"summary": "",
"description": "",
"returnValues": [
{
"type": "String",
"description": "Returns a promise that resolves to the file's completely resolved {String} path."
}
]
},
{
"name": "getBaseName",
"sectionName": "Managing Paths",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L173",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L194",
"visibility": "Public",

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

"sectionName": "Traversing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L181",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L202",
"visibility": "Public",

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

"sectionName": "Reading and Writing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L217",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L240",
"visibility": "Public",

@@ -637,3 +665,3 @@ "summary": "Reads the contents of the file.",

"sectionName": "Reading and Writing",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v3.1.0/src/file.coffee#L257",
"srcUrl": "https://github.com/atom/node-pathwatcher/blob/v4.0.0/src/file.coffee#L278",
"visibility": "Public",

@@ -640,0 +668,0 @@ "summary": "Overwrites the file with the given text.",

@@ -20,3 +20,3 @@ (function() {

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

@@ -46,11 +46,5 @@ runas = null;

function File(filePath, symlink) {
var error;
this.symlink = symlink != null ? symlink : false;
this.didRemoveSubscription = __bind(this.didRemoveSubscription, this);
this.willAddSubscription = __bind(this.willAddSubscription, this);
if (fs.isDirectorySync(filePath)) {
error = new Error("" + filePath + " is a directory");
error.code = 'EISDIR';
throw error;
}
if (filePath) {

@@ -109,6 +103,6 @@ filePath = path.normalize(filePath);

File.prototype.willAddSubscription = function() {
if (this.exists() && this.subscriptionCount === 0) {
this.subscribeToNativeChangeEvents();
}
return this.subscriptionCount++;
this.subscriptionCount++;
try {
return this.subscribeToNativeChangeEvents();
} catch (_error) {}
};

@@ -146,2 +140,10 @@

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

@@ -151,6 +153,17 @@ };

File.prototype.getDigest = function() {
var _ref1;
return (_ref1 = this.digest) != null ? _ref1 : this.setDigest(this.readSync());
if (this.digest) {
return Q(this.digest);
}
return this.read().then((function(_this) {
return function(contents) {
return _this.digest;
};
})(this));
};
File.prototype.getDigestSync = function() {
this.readSync();
return this.digest;
};
File.prototype.setDigest = function(contents) {

@@ -184,2 +197,3 @@ return this.digest = crypto.createHash('sha1').update(contents != null ? contents : '').digest('hex');

var error;
Grim.deprecate("Use File::getRealPath instead");
if (this.realPath == null) {

@@ -196,2 +210,14 @@ try {

File.prototype.getRealPath = function() {
if (this.realPath != null) {
return Q(this.realPath);
} else {
return Q.nfcall(fs.realpath, this.path).then((function(_this) {
return function(realPath) {
return _this.realPath = realPath;
};
})(this));
}
};
File.prototype.getBaseName = function() {

@@ -220,3 +246,4 @@ return path.basename(this.path);

var encoding;
if (!this.exists()) {
Grim.deprecate("Use File::read instead");
if (!this.existsSync()) {
this.cachedContents = null;

@@ -240,2 +267,3 @@ } else if ((this.cachedContents == null) || flushCache) {

var encoding;
Grim.deprecate("Use File::write instead");
encoding = this.getEncoding();

@@ -256,8 +284,5 @@ if (encoding === 'utf8') {

var bytesRead, content, deferred, encoding, promise, readStream;
if (Q == null) {
Q = require('q');
}
if (!this.exists()) {
promise = Q(null);
} else if ((this.cachedContents == null) || flushCache) {
if ((this.cachedContents != null) && !flushCache) {
promise = Q(this.cachedContents);
} else {
deferred = Q.defer();

@@ -287,6 +312,8 @@ promise = deferred.promise;

readStream.on('error', function(error) {
return deferred.reject(error);
if (error.code === 'ENOENT') {
return deferred.resolve(null);
} else {
return deferred.reject(error);
}
});
} else {
promise = Q(this.cachedContents);
}

@@ -302,10 +329,28 @@ return promise.then((function(_this) {

File.prototype.write = function(text) {
var previouslyExisted;
previouslyExisted = this.exists();
this.writeFileWithPrivilegeEscalationSync(this.getPath(), text);
this.cachedContents = text;
if (!previouslyExisted && this.hasSubscriptions()) {
this.subscribeToNativeChangeEvents();
return this.exists().then((function(_this) {
return function(previouslyExisted) {
return _this.writeFile(_this.getPath(), text).then(function() {
_this.cachedContents = text;
if (!previouslyExisted && _this.hasSubscriptions()) {
_this.subscribeToNativeChangeEvents();
}
return void 0;
});
};
})(this));
};
File.prototype.writeFile = function(filePath, contents) {
var encoding;
encoding = this.getEncoding();
if (encoding === 'utf8') {
return Q.nfcall(fs.writeFile(filePath, contents, {
encoding: encoding
}));
} else {
if (iconv == null) {
iconv = require('iconv-lite');
}
return Q.nfcall(fs.writeFile, filePath, iconv.encode(contents, encoding));
}
return void 0;
};

@@ -400,10 +445,14 @@

File.prototype.detectResurrection = function() {
if (this.exists()) {
this.subscribeToNativeChangeEvents();
return this.handleNativeChangeEvent('resurrect', this.getPath());
} else {
this.cachedContents = null;
this.emit('removed');
return this.emitter.emit('did-delete');
}
return this.exists().then((function(_this) {
return function(exists) {
if (exists) {
_this.subscribeToNativeChangeEvents();
return _this.handleNativeChangeEvent('resurrect', _this.getPath());
} else {
_this.cachedContents = null;
_this.emit('removed');
return _this.emitter.emit('did-delete');
}
};
})(this));
};

@@ -410,0 +459,0 @@

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

"description": "Watch files and directories for changes",
"version": "3.1.0",
"version": "4.0.0",
"licenses": [

@@ -8,0 +8,0 @@ {

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