Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Add callback for fs.unlink() #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions photos/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,13 @@ function downloadFile(url, dest, cb) {

// check for request errors
sendReq.on("error", err => {
fs.unlink(dest);
fs.unlink(dest, (err) => {});
console.log(err.message);
});

file.on("error", err => {
// Handle errors
fs.unlink(dest); // Delete the file async. (But we don't check the result)
fs.unlink(dest, (err) => {}); // Delete the file async. (But we don't check the result)
console.log(err.message);
});
}
Expand Down Expand Up @@ -642,4 +642,4 @@ function shuffle(a) {
a[j] = x;
}
return a;
}
}