🔨 Clean the entire temp folder on upload end

This commit is contained in:
Sebastien Clement 2020-01-10 18:20:57 +01:00
parent cd7ca7344d
commit bf8d271f4d

View File

@ -198,7 +198,7 @@ class WebdavTools {
status.last_backup = moment().format('MMM D, YYYY HH:mm') status.last_backup = moment().format('MMM D, YYYY HH:mm')
statusTools.setStatus(status); statusTools.setStatus(status);
fs.unlinkSync('./temp/' + id + '.tar') cleanTempFolder();
resolve(); resolve();
} }
}) })
@ -219,6 +219,16 @@ class WebdavTools {
function cleanTempFolder(){
fs.readdir("./temp/", (err, files) => {
if (err) throw err;
for (const file of files) {
fs.unlink(path.join("./temp/", file), err => {
if (err) throw err;
});
}
});
} }