Point release, adds some stuff from pull request #55
This commit is contained in:
parent
f6074405ba
commit
0f21829511
2 changed files with 29 additions and 22 deletions
|
|
@ -14,7 +14,6 @@
|
||||||
var fs = require("fs"),
|
var fs = require("fs"),
|
||||||
_path = require("path");
|
_path = require("path");
|
||||||
|
|
||||||
|
|
||||||
/* wrench.readdirSyncRecursive("directory_path");
|
/* wrench.readdirSyncRecursive("directory_path");
|
||||||
*
|
*
|
||||||
* Recursively dives through directories and read the contents of all the
|
* Recursively dives through directories and read the contents of all the
|
||||||
|
|
@ -202,6 +201,8 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
|
||||||
|
|
||||||
var contents = fs.readFileSync(srcFile);
|
var contents = fs.readFileSync(srcFile);
|
||||||
fs.writeFileSync(destFile, contents);
|
fs.writeFileSync(destFile, contents);
|
||||||
|
var stat = fs.lstatSync(srcFile);
|
||||||
|
fs.chmodSync(destFile, stat.mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
if(currFile.isDirectory()) {
|
if(currFile.isDirectory()) {
|
||||||
|
|
@ -289,6 +290,9 @@ exports.chownSyncRecursive = function(sourceDir, uid, gid) {
|
||||||
* Recursively dives through directories and obliterates everything about it.
|
* Recursively dives through directories and obliterates everything about it.
|
||||||
*/
|
*/
|
||||||
exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
|
exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
|
||||||
|
if(clbk === null || typeof clbk == 'undefined')
|
||||||
|
clbk = function(err) {};
|
||||||
|
|
||||||
fs.readdir(dir, function(err, files) {
|
fs.readdir(dir, function(err, files) {
|
||||||
if(err && typeof failSilent === 'boolean' && !failSilent)
|
if(err && typeof failSilent === 'boolean' && !failSilent)
|
||||||
return clbk(err);
|
return clbk(err);
|
||||||
|
|
@ -324,6 +328,9 @@ exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
|
||||||
*/
|
*/
|
||||||
exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) {
|
exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) {
|
||||||
var originalArguments = Array.prototype.slice.apply(arguments);
|
var originalArguments = Array.prototype.slice.apply(arguments);
|
||||||
|
srcDir = _path.normalize(srcDir);
|
||||||
|
newDir = _path.normalize(newDir);
|
||||||
|
|
||||||
fs.stat(newDir, function(err, newDirStat){
|
fs.stat(newDir, function(err, newDirStat){
|
||||||
if(!err) {
|
if(!err) {
|
||||||
if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete)
|
if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "wrench",
|
"name": "wrench",
|
||||||
"description": "Recursive filesystem (and other) operations that Node *should* have.",
|
"description": "Recursive filesystem (and other) operations that Node *should* have.",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"author": "Ryan McGrath <ryan@venodesigns.net>",
|
"author": "Ryan McGrath <ryan@venodesigns.net>",
|
||||||
|
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
||||||
Reference in a new issue