ryanmcgrath / wrench-js

Recursive file operations in Node.js
MIT License
435 stars 71 forks source link

Consider graceful-fs #68

Open silverwind opened 10 years ago

silverwind commented 10 years ago

Hey, I'm regulary running into issues with EACCES / ENOENT when recursively removing directories containing thousands of files with wrench.rmdirSyncRecursive on a Windows server.

Now I'm wondering if you would consider using graceful-fs, which is a drop-in replacement for node's fs module and seems to solve a lot of issues I had with locked files on Windows.

I can send a PR if you like.

ryanmcgrath commented 10 years ago

Interesting, this seems like it would be useful - would be open to a pull request, but at the moment I'm unable to attend to this.

(I'm aware this is 2 months old; lot of things taking up my time at the moment, sadly. Sorry!)

silverwind commented 10 years ago

Alright, will send a PR shortly.

silverwind commented 10 years ago

Actually, I'll try the new release first as https://github.com/ryanmcgrath/wrench-js/pull/73 looks promising to fix the Windows issues I'm having.

ryanmcgrath commented 10 years ago

Cool! Definitely let me know if it works for you.

silverwind commented 10 years ago

Nope, I was still hitting an ENOTEMPTY pretty fast when running rmdirSyncRecursive on a mozilla-central source tree (250k files), while graceful-fs deleted it without a hitch.

I'll test some more before submitting the PR, just out of curiosity which part of graceful-fs is actually solving these errors.

Also to note, this module would bump your min version of node to 0.4.0.

silverwind commented 10 years ago

I haven't found time to dissect graceful-fs yet, but I think the issue is corrected somewhere in polyfills.js.

I've submitted the PR now as-is. I don't think the switch would cause any issues, but just to be save, I'd suggest bumping the minor version.