fs: implement recursive (mkdirp) functionality
I'm an advocate of a small core library (and this is a big part of why such an amazing ecosystem of modules has grown up around Node.js and JavaScript).
Having said this, I love the Tooling Group initiative being advocated by @boneskull; some modules are so prolific, and the behavior at this point in Node's history so standardized, that the functionality should probably simply be part of the core API.
Two great examples of this are mkdirp
and rimraf
.
mkdirp
and rimraf
get downloaded over 8,000,000
times a day, and are dependencies of some 250,000 applications on GitHub -- wow!.
This pull request implements mkdirp
by adding a parent
(make the parents) boolean option to mkdir
, mkdirSync
, and promises.mkdir
methods.
I've opted to implement the feature in C++ mainly because the codepath wasn't shared for mkdir
and promises.mkdir
and this felt like a good way to DRY things up a bit.
Interested to hear what people think, and excited for future discussions around Node tooling.
CC: @stefanpenner, @cb1kenobi.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines