MCPcopy Index your code
hub / github.com/acode/cli / rmdir

Function rmdir

cli/commands/download.js:15–31  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

13const chalk = require('chalk');
14
15function rmdir(dir) {
16 if (!fs.existsSync(dir)) {
17 return null;
18 }
19 fs.readdirSync(dir).forEach(f => {
20 let pathname = path.join(dir, f);
21 if (!fs.existsSync(pathname)) {
22 return fs.unlinkSync(pathname);
23 }
24 if (fs.statSync(pathname).isDirectory()) {
25 return rmdir(pathname);
26 } else {
27 return fs.unlinkSync(pathname);
28 }
29 });
30 return fs.rmdirSync(dir);
31};
32
33class GetCommand extends Command {
34

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected