Comparing version 1.3.0 to 1.3.1
@@ -216,2 +216,26 @@ /* wrench.js | ||
var mkdirSyncRecursive = function(path, mode) { | ||
var self = this; | ||
try { | ||
fs.mkdirSync(path, mode); | ||
} catch(err) { | ||
if(err.code == "ENOENT") { | ||
var slashIdx = path.lastIndexOf("/"); | ||
if(slashIdx > 0) { | ||
var parentPath = path.substring(0, slashIdx); | ||
mkdirSyncRecursive(parentPath, mode); | ||
mkdirSyncRecursive(path, mode); | ||
} else { | ||
throw err; | ||
} | ||
} else if(err.code == "EEXIST") { | ||
return; | ||
} else { | ||
throw err; | ||
} | ||
} | ||
}; | ||
exports.mkdirSyncRecursive = mkdirSyncRecursive; | ||
exports.LineReader = function(filename, bufferSize) { | ||
@@ -253,1 +277,3 @@ this.bufferSize = bufferSize || 8192; | ||
}; | ||
// vim: et ts=4 sw=4 |
{ | ||
"name": "wrench", | ||
"description": "Recursive filesystem (and other) operations that Node *should* have.", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"author": "Ryan McGrath <ryan@venodesigns.net>", | ||
@@ -6,0 +6,0 @@ |
@@ -22,2 +22,5 @@ wrench.js - Recursive file operations in Node.js | ||
// Recursively create directories, sub-trees and all. | ||
wrench.mkdirSyncRecursive(dir, 0777); | ||
// Recursively delete the entire sub-tree of a directory, then kill the directory | ||
@@ -24,0 +27,0 @@ wrench.rmdirSyncRecursive('my_directory_name'); |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
14021
6
254
46
2