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.2.0 to 1.3.0

29

lib/wrench.js

@@ -11,4 +11,2 @@ /* wrench.js

*
* These are all developed due to my work on Luno (http://github.com/ryanmcgrath/luno).
*
* ~ Ryan McGrath (ryan [at] venodesigns.net)

@@ -117,3 +115,30 @@ */

/* wrench.chownSyncRecursive("directory", uid, gid);
*
* Recursively dives through a directory and chowns everything to the desired user and group. This is a
* Synchronous function, which blocks things until it's done.
*
* Note: Directories should be passed to this function without a trailing slash.
*/
exports.chownSyncRecursive = function(sourceDir, uid, gid) {
var files = fs.readdirSync(sourceDir);
for(var i = 0; i < files.length; i++) {
var currFile = fs.statSync(sourceDir + "/" + files[i]);
if(currFile.isDirectory()) {
/* ...and recursion this thing right on back. */
exports.chownSyncRecursive(sourceDir + "/" + files[i], uid, gid);
} else {
/* At this point, we've hit a file actually worth chowning... so own it. */
fs.chownSync(sourceDir + "/" + files[i], uid, gid);
}
}
/* Finally, chown the parent directory */
fs.chownSync(sourceDir, uid, gid);
};
/* wrench.rmdirRecursive("directory_path", callback);

@@ -120,0 +145,0 @@ *

2

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

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

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

``` javascript
var wrench = require('./wrench'),
var wrench = require('wrench'),
util = require('util');

@@ -29,2 +29,5 @@

// Recursively chown the entire sub-tree of a directory
wrench.chownSyncRecursive("directory", uid, gid);
// Deep-copy an existing directory

@@ -31,0 +34,0 @@ wrench.copyDirSyncRecursive('directory_to_copy', 'location_where_copy_should_end_up');

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