What is the best way to delete several files in node.js?
function deleteFiles(files, callback){ ... } var files = [\'file1.js\', \'file2.jpg\', \'file3.css\
This is what I am currently using and works a treat:
var files = ['file1.js', 'file2.jpg', 'file3.css']; function deleteFiles(files){ for (const file of files) { fs.unlink((file), err => { if (err) throw err; }); }; } deleteFiles(files);