-
Notifications
You must be signed in to change notification settings - Fork 772
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
Remove: Option for Error on Missing File or Directory #785
Conversation
Added a `shoutMissing` flag to remove() options that when set to `true` will emit an error when the specified file or directory is missing. The default is `false`, existing users are not affected. Fixes jprichardson#246 Partially
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@RyanZim I am unable to understand your logic. The whole point of this library is to provide file-system functionality that node is unable to. I could use node's API if I just wanted parity! And it seems from the discussion in #246 that this is a popular request that many people have asked for. The reason offered for non-inclusion, quite incorrectly I might add, was that such a change would be breaking! This is NOT a breaking change! |
Until Node v12.10.0; there was no way to remove a directory with contents. So https://www.npmjs.com/package/rimraf was created to fill that gap. @jprichardson made this library because he got tired of installing rimraf and other similar utility modules on every project, so he bundled them all in this library. We now use a forked/vendored version of rimraf, but the codebase hasn't deviated much. Now, finally Node core is beginning to add some of these common tasks to the core In regards to adding this functionality in general (i.e. via a new method):
Looking at #246, if I counted right, there's a grand total of 6 people in favour of it. For a package that's depended on by nearly 4 million other packages, I'm not convinced it qualifies as a popular request. If we added every request that 6 developers asked for, we'd quickly end up with a massive, bloated, & complicated library. That said, I could be making the wrong call here. As I've stated before, if any of the maintainers disagree, I'd be happy to hear their point of view. Thinking about this discussion, it does bring up an interesting point in my mind; it is a bit odd the way this works in Node core. Quoting Node docs:
There'd be a much stronger argument to say that Node core should not swallow Might not be a dumb idea to open to open an issue on Node itself about this. If Node core changed functionality/added an option, my opinion on supporting this in |
@RyanZim Thanks for a very detailed reply. I am more sympathetic to your thought process. But I still have to disagree. Let me see if I can explain my POV better:
Now, I do not see how you can get rid of In any case, I would also welcome more input; we all want the best possible outcome!!!! Now to some of your comments:
I think the way node is approaching this is wrong. Having followed posix conventions all along, they seem to have suddenly abandoned it with these poorly thought out flags on
With all due respect, I cannot help but chuckle! You speak of gazillions of users, I submit to you that there have ever been only 500 odd issues filed and 300 PRs (and much fewer of that would be regarding feature requests). Very few users ever speak up and even fewer submit changes. Sure, popular may be overstating it, but in the context of those numbers, my "grand total" of 6 people over the span of a couple of years speaking up on the same matter might not just be incidental or accidental. Statistics can be used to trivialize anything!
Of course, I share your aversion to adding bloat but at the same time I believe that one should strive for feature completeness as well. It is difficult balance. However, in this case, a comparison with |
You're correct that so far, Node has mostly be modelled after POSIX. The logic being implemented for recursive Re: your comments about statistics, fair points. Not 100% sure I agree, but haven't given the matter deep thought. Regardless, that's neither here nor there ATM, since I won't be moving forward here until I get clarity on what Node is doing/thinking. |
Fair enough! Lets see what the folks at Node have to say.... |
@RyanZim I finally remembered to file that issue!!! Hope its OK that i took the liberty to link you in the discussion. |
Yes, thanks. Was meaning to do it myself, but didn't make it a priority. Thanks for going ahead; commented my thoughts there. |
@RyanZim Node has now "fixed" recursive remove! The ball is in your court now... |
@CxRes Please file an issue so we can discuss potential APIs for doing this. |
Please reopen #246! |
Fresh thread filed: #840 |
As discussed in #246, this is a PR to allow for error message on ENOENT. I have provisionally only fixed
remove()
by adding aoptions.shoutMissing
flag which is false by default.I have made the changes defensively, since this is a library to fix the quirks of node fs and I am worried about breaking stuff. However, I have made more aggressive suggestions in the comments along side. Please examine and test it (I do not have access to all environments) and I'll make a proper PR according to your feedback.