Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wrench

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wrench - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

22

lib/wrench.js

@@ -16,3 +16,3 @@ /* wrench.js

/* wrench.rmdirSyncRecursive("directory_path");
/* wrench.rmdirSyncRecursive("directory_path", forceDelete, failSilent);
*

@@ -23,18 +23,24 @@ * Recursively dives through directories and obliterates everything about it. This is a

*/
exports.rmdirSyncRecursive = function(path) {
var files = fs.readdirSync(path),
currDir = path;
exports.rmdirSyncRecursive = function(path, failSilent) {
var files;
try {
files = fs.readdirSync(path);
} catch (err) {
if(failSilent) return;
throw new Error(err.message);
}
/* Loop through and delete everything in the sub-tree after checking it */
for(var i = 0; i < files.length; i++) {
var currFile = fs.statSync(currDir + "/" + files[i]);
var currFile = fs.statSync(path + "/" + files[i]);
if(currFile.isDirectory()) // Recursive function back to the beginning
exports.rmdirSyncRecursive(currDir + "/" + files[i]);
exports.rmdirSyncRecursive(path + "/" + files[i]);
else if(currFile.isSymbolicLink()) // Unlink symlinks
fs.unlinkSync(currDir + "/" + files[i]);
fs.unlinkSync(path + "/" + files[i]);
else // Assume it's a file - perhaps a try/catch belongs here?
fs.unlinkSync(currDir + "/" + files[i]);
fs.unlinkSync(path + "/" + files[i]);
}

@@ -41,0 +47,0 @@

{
"name": "wrench",
"description": "Recursive filesystem (and other) operations that Node *should* have.",
"version": "1.3.2",
"version": "1.3.3",
"author": "Ryan McGrath <ryan@venodesigns.net>",

@@ -6,0 +6,0 @@

@@ -26,3 +26,3 @@ wrench.js - Recursive file operations in Node.js

// Recursively delete the entire sub-tree of a directory, then kill the directory
wrench.rmdirSyncRecursive('my_directory_name');
wrench.rmdirSyncRecursive('my_directory_name', failSilently);

@@ -29,0 +29,0 @@ // Recursively chmod the entire sub-tree of a directory

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc