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.5.4 to 1.5.5

tests/rmdirSyncRecursive.js

31

lib/wrench.js

@@ -15,3 +15,4 @@ /* wrench.js

var fs = require("fs"),
_path = require("path");
_path = require("path"),
isWindows = !!process.platform.match(/^win/);

@@ -126,3 +127,3 @@ /* wrench.readdirSyncRecursive("directory_path");

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

@@ -139,2 +140,3 @@ * Recursively dives through directories and obliterates everything about it. This is a

} catch (err) {
if(failSilent) return;

@@ -146,12 +148,23 @@ throw new Error(err.message);

for(var i = 0; i < files.length; i++) {
var currFile = fs.lstatSync(_path.join(path, files[i]));
var file = _path.join(path, files[i]);
var currFile = fs.lstatSync(file);
if(currFile.isDirectory()) // Recursive function back to the beginning
exports.rmdirSyncRecursive(_path.join(path, files[i]));
if(currFile.isDirectory()) {
// Recursive function back to the beginning
exports.rmdirSyncRecursive(file);
} else if(currFile.isSymbolicLink()) {
// Unlink symlinks
if (isWindows) {
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved..
}
else if(currFile.isSymbolicLink()) // Unlink symlinks
fs.unlinkSync(_path.join(path, files[i]));
fs.unlinkSync(file);
} else {
// Assume it's a file - perhaps a try/catch belongs here?
if (isWindows) {
fs.chmodSync(file, 666) // Windows needs this unless joyent/node#3006 is resolved..
}
else // Assume it's a file - perhaps a try/catch belongs here?
fs.unlinkSync(_path.join(path, files[i]));
fs.unlinkSync(file);
}
}

@@ -158,0 +171,0 @@

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

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

@@ -7,3 +7,4 @@ // `nodeunit tests/runner`

group_readdir: require('./readdir'),
group_copydir: require('./copydirsync_unix')
group_copydir: require('./copydirsync_unix'),
group_rmdir: require('./rmdirSyncRecursive')
};
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