check and log all fs.unlink errors

This commit is contained in:
barisusakli
2015-09-06 00:49:39 -04:00
parent 31fef4f429
commit cf193581e4
3 changed files with 34 additions and 8 deletions

View File

@@ -136,9 +136,14 @@ function uploadFile(uid, uploadedFile, callback) {
}
function deleteTempFiles(files) {
for(var i=0; i<files.length; ++i) {
fs.unlink(files[i].path);
}
async.each(files, function(file, next) {
fs.unlink(file.path, function(err) {
if (err) {
winston.error(err);
}
next();
});
});
}