From 8942eff203c846f2e17c055176f235382f646e8b Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 4 Nov 2018 21:09:27 -0700 Subject: [PATCH] Fix deprecated write() without callback for Node.js 10.x+ --- core/file_transfer.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/file_transfer.js b/core/file_transfer.js index dbd19a8f..340ca6b9 100644 --- a/core/file_transfer.js +++ b/core/file_transfer.js @@ -314,9 +314,13 @@ exports.getModule = class TransferFileModule extends MenuModule { return callback(err); // failed to create it } - fs.write(tempFileInfo.fd, filePaths.join(SYSTEM_EOL)); - fs.close(tempFileInfo.fd, err => { - return callback(err, tempFileInfo.path); + fs.write(tempFileInfo.fd, filePaths.join(SYSTEM_EOL), err => { + if(err) { + return callback(err); + } + fs.close(tempFileInfo.fd, err => { + return callback(err, tempFileInfo.path); + }); }); }); },