Created
August 31, 2019 20:54
-
-
Save kaizhu256/7ca01ba0cb671a81a25fd7b43b574d48 to your computer and use it in GitHub Desktop.
one-liner to rm -rf in nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fsRmrSync (dir) { | |
/* | |
* this function will sync "rm -rf" <dir> | |
*/ | |
require("child_process").spawnSync("rm", [ | |
"-rf", dir | |
], { | |
stdio: [ | |
"ignore", 1, 2 | |
] | |
}); | |
}; | |
fsRmrSync("/tmp/foo/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment