Comparing version 2.0.1 to 2.0.2
@@ -42,2 +42,45 @@ // Generated by CoffeeScript 1.6.2 | ||
}, | ||
getParentPathSync: function(p) { | ||
var parentPath; | ||
parentPath = p.replace(/[\/\\]$/, '').replace(/[\/\\][^\/\\]+$/, ''); | ||
return parentPath; | ||
}, | ||
ensurePath: function(path, options, next) { | ||
var _ref4; | ||
if (next == null) { | ||
next = options; | ||
options = null; | ||
} | ||
if (options == null) { | ||
options = {}; | ||
} | ||
if ((_ref4 = options.mode) == null) { | ||
options.mode = 0x1ff & (~process.umask()); | ||
} | ||
safefs.exists(path, function(exists) { | ||
var parentPath; | ||
if (exists) { | ||
return next(null, true); | ||
} | ||
parentPath = balUtilPaths.getParentPathSync(path); | ||
return safefs.ensurePath(parentPath, options, function(err) { | ||
if (err) { | ||
return next(err, false); | ||
} | ||
return safefs.mkdir(path, options.mode, function(err) { | ||
return safefs.exists(path, function(exists) { | ||
if (!exists) { | ||
err = new Error("Failed to create the directory: " + path); | ||
return next(err, false); | ||
} | ||
return next(null, false); | ||
}); | ||
}); | ||
}); | ||
}); | ||
return this; | ||
}, | ||
readFile: function(path, options, next) { | ||
@@ -61,3 +104,3 @@ if (next == null) { | ||
} | ||
safefs.ensurePath(pathUtil.dirname(path), function(err) { | ||
safefs.ensurePath(pathUtil.dirname(path), options, function(err) { | ||
if (err) { | ||
@@ -80,3 +123,3 @@ return next(err); | ||
} | ||
safefs.ensurePath(pathUtil.dirname(path), function(err) { | ||
safefs.ensurePath(pathUtil.dirname(path), options, function(err) { | ||
if (err) { | ||
@@ -83,0 +126,0 @@ return next(err); |
{ | ||
"name": "safefs", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Say goodbye to EMFILE errors! Open only as many files as the operating system supports", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/safefs", |
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
9881
192