One liner for rimraf that gets the job done

I have been striving to cut down on node_modules. Most of the times, I need rimraf to delete a folder (usually public/dist/build) and to keep the project cross platform. So, here is a one-liner to delete a folder/file:

node -e "require('fs').rmSync('PATH',{recursive:true,force:true})"

Note: Replace PATH by the path to the folder/file. This works the same as rm -rf command, but cross-platform.


Have a question regarding this article?

📧 Email me your thoughts on my first name @ this domain. I haven't given away my email directly to prevent spamming, but if you are a human, you can figure it out.