Skip to content

Commit

Permalink
Switch from to fs.unlinkSync to fix node 10 err (#27)
Browse files Browse the repository at this point in the history
fs.unlink fails without the `callback` param in node 10 it seems. Switching to fs.unlinkSync fixes the problem for me.

```
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at makeCallback (fs.js:135:11)
    at Object.unlink (fs.js:903:14)
```
  • Loading branch information
tmjoen authored and DanielHindi committed Aug 5, 2019
1 parent 7c202e5 commit b5035d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ S3Zipper.prototype = {
zipFileLocation: result.Location,
zippedFiles: r.zippedFiles
});
fs.unlink(params.zipFileName);
fs.unlinkSync(params.zipFileName);
});
}
else {
console.log('no files zipped. nothing to upload');
fs.unlink(params.zipFileName);
fs.unlinkSync(params.zipFileName);
callback(null, {
zipFileETag: null,
zipFileLocation: null,
Expand Down Expand Up @@ -382,7 +382,7 @@ S3Zipper.prototype = {
if (uploadResult) {
result.uploadedFile = uploadResult;
console.log('remove temp file ', localFragName);
fs.unlink(localFragName);
fs.unlinkSync(localFragName);
}
pendingUploads--;
if (pendingUploads == 0 && finalResult) {
Expand Down Expand Up @@ -483,7 +483,7 @@ S3Zipper.prototype = {
fileStream.close();
if (result.zippedFiles.length == 0) /// its an empty zip file get rid of it

fs.unlink(fragFileName);
fs.unlinkSync(fragFileName);

else
events.onFileZipped(fragFileName, result);
Expand Down

0 comments on commit b5035d6

Please sign in to comment.