Minor tangent, but plucked from that article, why is ‘rimraf’ downloaded 60m+ time a week?! Why is that a thing that need a library? (Asking as a systems guy, not a programmer)
The OP already explained that - because people want their package.json scripts to be cross-platform, and „rm” does not exist on Windows. So instead you add rimraf to your dependencies and use that instead of rm in your scripts.
It’s quite often used in npm scripts to cleanup stuff (say, between builds), and many developers prefer that over native solutions like `rm` and `del` as it gives them a cross-platform way of cleaning up files and folders.
Yes 60m downloads is a lot of downloads. But it’s not 60m developers manually clicking the download link every week. Not is it 60m times that “npm install rimraf” has been called.
What is happening is that many projects, some big some just hello world tutorials, have listed rimraf in the package.json file for that project. Then when “npm install” is run, all the packages get downloaded.
And what is more, many people build their software in CI builds, like travisci, circleci, or GitHub actions. The build scripts will also then downloaded everything listed in package.json. And if you do multiple builds a day, then that’s multiple downloads each day.
Is it very inefficient? Yes it is.
And npmjs.com will block your IP if you do too many downloads in on day.
Which languages have a recursive delete in their standard library, other than shell? Do any? HShell (see other comments) also implements its own rm() function because the JDK standard library is too low level to support something like that.