how to delete files inside a folder node fs code example
Example 1: nodejs fs delete file
const fs = require('fs')
const path = './file.txt'
try {
fs.unlinkSync(path)
//file removed
} catch(err) {
console.error(err)
}
Example 2: how to delete a folder using node js
fs.unlink('./node/myText.txt',function(){
fs.rmdir('node');
});