graceful-fs
Advanced tools
Comparing version 4.1.4 to 4.1.5
{ | ||
"name": "graceful-fs", | ||
"description": "A drop-in replacement for fs, making various improvements.", | ||
"version": "4.1.4", | ||
"version": "4.1.5", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -47,5 +47,5 @@ var fs = require('./fs.js') | ||
fs.chmod = chownFix(fs.chmod) | ||
fs.fchmod = chownFix(fs.fchmod) | ||
fs.lchmod = chownFix(fs.lchmod) | ||
fs.chmod = chmodFix(fs.chmod) | ||
fs.fchmod = chmodFix(fs.fchmod) | ||
fs.lchmod = chmodFix(fs.lchmod) | ||
@@ -56,5 +56,5 @@ fs.chownSync = chownFixSync(fs.chownSync) | ||
fs.chmodSync = chownFix(fs.chmodSync) | ||
fs.fchmodSync = chownFix(fs.fchmodSync) | ||
fs.lchmodSync = chownFix(fs.lchmodSync) | ||
fs.chmodSync = chmodFixSync(fs.chmodSync) | ||
fs.fchmodSync = chmodFixSync(fs.fchmodSync) | ||
fs.lchmodSync = chmodFixSync(fs.lchmodSync) | ||
@@ -64,3 +64,3 @@ // if lchmod/lchown do not exist, then make them no-ops | ||
fs.lchmod = function (path, mode, cb) { | ||
process.nextTick(cb) | ||
if (cb) process.nextTick(cb) | ||
} | ||
@@ -71,3 +71,3 @@ fs.lchmodSync = function () {} | ||
fs.lchown = function (path, uid, gid, cb) { | ||
process.nextTick(cb) | ||
if (cb) process.nextTick(cb) | ||
} | ||
@@ -128,3 +128,2 @@ fs.lchownSync = function () {} | ||
fs.lchmod = function (path, mode, callback) { | ||
callback = callback || noop | ||
fs.open( path | ||
@@ -135,3 +134,3 @@ , constants.O_WRONLY | constants.O_SYMLINK | ||
if (err) { | ||
callback(err) | ||
if (callback) callback(err) | ||
return | ||
@@ -143,3 +142,3 @@ } | ||
fs.close(fd, function(err2) { | ||
callback(err || err2) | ||
if (callback) callback(err || err2) | ||
}) | ||
@@ -177,7 +176,9 @@ }) | ||
fs.open(path, constants.O_SYMLINK, function (er, fd) { | ||
cb = cb || noop | ||
if (er) return cb(er) | ||
if (er) { | ||
if (cb) cb(er) | ||
return | ||
} | ||
fs.futimes(fd, at, mt, function (er) { | ||
fs.close(fd, function (er2) { | ||
return cb(er || er2) | ||
if (cb) cb(er || er2) | ||
}) | ||
@@ -208,3 +209,3 @@ }) | ||
} else { | ||
fs.lutimes = function (_a, _b, _c, cb) { process.nextTick(cb) } | ||
fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } | ||
fs.lutimesSync = function () {} | ||
@@ -214,2 +215,24 @@ } | ||
function chmodFix (orig) { | ||
if (!orig) return orig | ||
return function (target, mode, cb) { | ||
return orig.call(fs, target, mode, function (er, res) { | ||
if (chownErOk(er)) er = null | ||
if (cb) cb(er, res) | ||
}) | ||
} | ||
} | ||
function chmodFixSync (orig) { | ||
if (!orig) return orig | ||
return function (target, mode) { | ||
try { | ||
return orig.call(fs, target, mode) | ||
} catch (er) { | ||
if (!chownErOk(er)) throw er | ||
} | ||
} | ||
} | ||
function chownFix (orig) { | ||
@@ -220,3 +243,3 @@ if (!orig) return orig | ||
if (chownErOk(er)) er = null | ||
cb(er, res) | ||
if (cb) cb(er, res) | ||
}) | ||
@@ -223,0 +246,0 @@ } |
@@ -10,3 +10,3 @@ # graceful-fs | ||
## Improvements over [fs module](http://api.nodejs.org/fs.html) | ||
## Improvements over [fs module](https://nodejs.org/api/fs.html) | ||
@@ -13,0 +13,0 @@ * Queues up `open` and `readdir` calls, and retries them once |
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
23030
567