const fs = require('fs'); const path = require('path'); const common = require('./common'); const tempDir = common.getAppPath(`${__dirname}/${common.TEMP_DIR}`); fs.readdir(tempDir, (err, files) => { if (err) throw err; for (const file of files) { fs.unlink(path.join(tempDir, file), err => { if (err) throw err; }); } });