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

wrench

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wrench

Recursive filesystem operations that Node *should* have.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
51K
decreased by-40.68%
Maintainers
0
Weekly downloads
 
Created
Source

wrench.js - Recursive file operations in Node.js

While I love Node.js, I've found myself missing some functions. Things like recursively deleting/chmodding a directory (or even deep copying a directory) shouldn't need to be re-invented time and time again.

That said, here's my attempt at a re-usable solution, at least until something more formalized gets integrated into Node.js (hint hint). wrench.js is fairly simple to use - check out the documentation/examples below:

var wrench = require("./wrench");

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

// Recursively chmod the entire sub-tree of a directory
wrench.chmodSyncRecursive("my_directory_name", 0755);

// Deep-copy an existing directory
wrench.copyDirSyncRecursive("directory_to_copy", "location_where_copy_should_end_up");

It should be noted that these are all currently synchronous operations. I'll be adding asynchronous versions of chmod/copy in the near future, but rmdir is one that really can't exist in an asynchronous fashion.

Questions, comments? Hit me up. (ryan [at] venodesigns.net | http://twitter.com/ryanmcgrath)

FAQs

Package last updated on 13 Apr 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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