MCPcopy Create free account
hub / github.com/Unitech/pm2 / deleteFolderRecursive

Function deleteFolderRecursive

lib/tools/deleteFolderRecursive.js:5–17  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

3const Path = require('path');
4
5const deleteFolderRecursive = function(path) {
6 if (fs.existsSync(path)) {
7 fs.readdirSync(path).forEach((file, index) => {
8 const curPath = Path.join(path, file);
9 if (fs.lstatSync(curPath).isDirectory()) { // recurse
10 deleteFolderRecursive(curPath);
11 } else { // delete file
12 fs.unlinkSync(curPath);
13 }
14 });
15 fs.rmdirSync(path);
16 }
17};
18
19module.exports = deleteFolderRecursive

Callers 3

uninstallFunction · 0.85
NPM.jsFile · 0.85
deleteModulePathFunction · 0.85

Calls 1

isDirectoryMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…