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?
发布评论
评论(1)
rimraf 不使用/不需要 shell,而 rm -rf 需要 shell。
编辑:
require('shelljs').rm()
也不使用 shell,所以我认为它们是等效的。另外:
解决方案通常有多种实现方式,因此选择一种实现方式取决于需求和个人喜好。
如果您计划使用 shelljs 中包含的其他功能,那么它是一个不错的选择。如果您只想使用 rm -rf rimraf 更有意义,因为您不需要 shelljs 的所有额外功能。
为工作选择正确的工具(或依赖项):您可以用火箭筒击落一只鸟,但为什么要这么做呢?
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?