UNPKG

pm2

Version:

Production process manager for Node.JS applications with a built-in load balancer.

20 lines (16 loc) 480 B
const fs = require('fs'); const Path = require('path'); const deleteFolderRecursive = function(path) { if (fs.existsSync(path)) { fs.readdirSync(path).forEach((file, index) => { const curPath = Path.join(path, file); if (fs.lstatSync(curPath).isDirectory()) { // recurse deleteFolderRecursive(curPath); } else { // delete file fs.unlinkSync(curPath); } }); fs.rmdirSync(path); } }; module.exports = deleteFolderRecursive