What is the difference between Rimraf and rm -rf through ShellJS

1.4k views Asked by At

rimraf,The UNIX command rm -rf for node,I think I can do the same thing with rm -rf through shelljs.so what is the diff

1

There are 1 answers

0
Marco On

rimraf doesn't use/need a shell while rm -rf needs a shell.

Edit:

require('shelljs').rm() also doesn't use a shell, so I'd say they're equivalent.

Also:

It's common for a solution to have multiple implementations, so choosing one over the other comes down to requirements and personal preference.

If you're planning on using other features that are included in shelljs, it's a good pick. If you're only going to use rm -rf rimraf makes more sense since you wouldn't need all that extra functionality of shelljs.

Choose the right tool (or dependency) for the job: you can shoot down a bird with a bazooka, but why would you?