Skip to content

Instantly share code, notes, and snippets.

@kaizhu256
Created August 31, 2019 20:54
Show Gist options
  • Save kaizhu256/7ca01ba0cb671a81a25fd7b43b574d48 to your computer and use it in GitHub Desktop.
Save kaizhu256/7ca01ba0cb671a81a25fd7b43b574d48 to your computer and use it in GitHub Desktop.
one-liner to rm -rf in nodejs
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