-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An optional parameter that lets us delete folders that aren't empty directly #22686
Comments
If we end up doing this, please no Boolean trap in the API signature. Use an options object instead. |
So basically |
I am working on a rimraf impl |
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. |
Thanks all for your suggestions! |
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. |
I had been waiting for the PR someone open. However, it seems not to be opened. So, I implemented on #24252 |
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
rmdirSync
orrmdir
, 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.
The text was updated successfully, but these errors were encountered: