Warning: This Project Is Deprecated!

Wrench was built for the early days of Node, and it solved a problem that needed solving. I'm proud of what it's done; at the time of writing this, it was still downloaded over 25,000 times yesterday, and over 500,000 times in the last month. The fact that it wound up being embedded in so many projects is humbling and a great source of fun for me, but I just don't have the time to keep up with this at the moment. No alternate maintainers have appeared, and fs-extra is very well maintained anyway - one community solution is likely better.

So long, and thanks for all the fish. The original docs remain available here for anyone who may need them. If I could 301 a GitHub repository I'd do so.

Cheers,

Ryan McGrath

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),
or even a basic line reader, 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:

Possibly Breaking Change in v1.5.0

In previous versions of Wrench, we went against the OS-default behavior of not
deleting a directory unless the operation is forced. In 1.5.0, this has been
changed to be the behavior people expect there to be - if you try to copy over
a directory that already exists, you'll get an Error returned or thrown stating
that you need to force it.

If you desire the older behavior of Wrench... hit up your package.json. If you
happen to find bugs in the 1.5.0 release please feel free to file them on the
GitHub issues tracker for this project, or send me a pull request and I'll get to
it as fast as I can. Thanks!

If this breaks enough projects I will consider rolling it back. Please hit me up if this seems to be the case.

Installation

npm install wrench

Usage

var wrench =require('wrench'),

util =require('util');

Synchronous operations

// Recursively create directories, sub-trees and all.

wrench.mkdirSyncRecursive(dir,0777);

// Recursively delete the entire sub-tree of a directory, then kill the directory