Repository navigation
An optional parameter that lets us delete folders that aren't empty directly #22686
Description
Activity
If we end up doing this, please no Boolean trap in the API signature. Use an options object instead.
Reacted by Benjamin Gruenbaum and Jimmy WärtingSo basically
rimraf? This is a pretty regular request around here. As far as an API — it should just be a separate function, much likemkdirp.I am working on a rimraf impl
Reacted by Benjamin Gruenbaum, Anatoli Papirovski, Dhananjay Gokhale and Sindre SorhusThat's not how we implemented recursive mkdir (#21875) -- the current code on master uses an options parameter (see also discussions in #22302 and #22585).
I'm aware but that's also the reason it hasn't been released. Given the feature testing angle, it's almost certain to land in an actual release as a separate function.
it's almost certain to land in an actual release as a separate function.
Was a decision made on this? It seemed to be still under consideration...
Was a decision made on this? It seemed to be still under consideration...
I'm interpolating from the available data points... 😆
Someone should just open the PR at this point. I will later this week if no one gets to it before then.
- addedfsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Sep 7, 2018 I had been waiting for the PR someone open. However, it seems not to be opened. So, I implemented on #24252
Please mention to me if someone open the PR implementing this.So the conclusion of #24252 is that doing it in C++ was not fast enough? Should a future attempt at this feature still be in C++ or would we be open to a JS-only solution too?
I guess we could make an attempt at porting rimraf to core, including its retry logic. @boneskull I see you mentioned attempting it, did you get anywere?
This is currently in progress here: #28208
Implemented in #29168.
Until now in Node 8.x, we CANNOT directly delete a folder with the sub folders with files. I'm not sure whether we can offer such a function because this is a common behaviour to delete a folder that is NOT empty (Considering the performance, we can write our core codes at C++ layer, and call it through js aspect).
For we've got
rmdirSyncorrmdir, maybe we can add an optional parameter to choose whether we allow to remove sub files/folders for the parent folder itself or not (In order to be compatible with it, the default value should befalse, this means when you remove a folder that isn't empty, error will be thrown out like what can see now), something like this following:PS:I know that some 3-rd parties have implemented this, but it would be better inject it into the nodejs's fs module, which is very useful and pratical.