lsxjh
lsxjh

Reputation: 31

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

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

Upvotes: 3

Views: 2234

Answers (1)

Marco
Marco

Reputation: 7271

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?

Upvotes: 1

Related Questions