Skip to content
This repository was archived by the owner on Feb 5, 2022. It is now read-only.

Commit f9667ab

Browse files
KSotolepture
authored andcommitted
Added error callback to download prototype
Fixing this issue: #18 If there is an error in the download function, it would break when trying to use "sftp". This fixes that.
1 parent f515624 commit f9667ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/client.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ Client.prototype.download = function(src, dest, callback) {
279279
var self = this;
280280

281281
self.sftp(function(err,sftp){
282+
if (err) {
283+
return callback(err);
284+
}
285+
282286
var sftp_readStream = sftp.createReadStream(src);
283287
sftp_readStream.on('error', function(err){
284288
callback(err);

0 commit comments

Comments
 (0)