Comparing version 1.0.0 to 1.0.1
23
index.js
@@ -22,5 +22,19 @@ /** | ||
del.empty = function(dirs) { | ||
if (!dirs) { | ||
return; | ||
} | ||
if (!util.isArray(dirs)) { | ||
dirs = [dirs]; | ||
} | ||
dirs.forEach(function(f) { | ||
_remove(f, true); | ||
}); | ||
}; | ||
module.exports = del; | ||
function _remove(file) { | ||
function _remove(file, empty) { | ||
if (!fs.existsSync(file)) { | ||
@@ -36,6 +50,9 @@ return; | ||
}); | ||
fs.rmdirSync(file); | ||
if (!empty) { | ||
fs.rmdirSync(file); | ||
} | ||
} else { | ||
fs.unlinkSync(file); | ||
} | ||
} | ||
} |
{ | ||
"name": "fs-del", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "delete files and folders", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,2 +16,6 @@ /** | ||
}); | ||
it.only('empty', function() { | ||
del.empty('E:/test/s3') | ||
}) | ||
}); |
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
2109
64