1const fs = require('fs');
2
3// directory path
4const dir = 'temp';
5
6// delete directory recursively
7try {
8 fs.rmdirSync(dir, { recursive: true });
9
10 console.log(`${dir} is deleted!`);
11} catch (err) {
12 console.error(`Error while deleting ${dir}.`);
13}