return promise.all(paths.files.map(function (filePath) { logger.writeln('Unlinking ' + filePath.cyan + ' because it was removed from src.'); if (justPretend) { return; } return fs.unlink(filePath); })).then(function () {
function() { console.log('something went wrong'); //TODO: Find a module to remove the (not empty) directory //with the invalid slides without throwing an error becasue //it deleted what it was suppose to delete... F**K! //or that does not delete everything as wrench-js used //below... F**K as well //wrench.rmdirRecursive(folderPath, function(err){ // if(err) throw err; pfs.unlink(req.files.upload.path).then(res.redirect('/')); //}); });
User.findByIdAndUpdate(req.user._id, { $push: {slides : newSlideshow._id } }, function(err, user) { pfs.unlink(req.files.upload.path).then(res.redirect('/user/')); });
function() { if (result[2]) pfs.unlink(folderPath + '/questions.json'); },
function() { if (result[1]) pfs.unlink(folderPath + '/assets.json'); },