Answers for "node js fs delete directory"

0

delete dir nodejs

fs.rmdirSync(dir, { recursive: true });
Posted by: Guest on August-06-2020
2

node js delete folder with files

const fs = require('fs');

// directory path
const dir = 'temp';

// delete directory recursively
try {
    fs.rmdirSync(dir, { recursive: true });

    console.log(`${dir} is deleted!`);
} catch (err) {
    console.error(`Error while deleting ${dir}.`);
}
Posted by: Guest on July-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language