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

Commit cb98926

Browse files
committed
allow Key override at getS3Params()
1 parent d0946f6 commit cb98926

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ Client.prototype.downloadFile = function(params) {
460460
if (statusCode >= 300) {
461461
handleError(new Error("http status code " + statusCode));
462462
return;
463-
}
463+
}
464464
if (headers['content-length'] == undefined) {
465465
var outStream = fs.createWriteStream(localFile);
466466
outStream.on('error', handleError);
@@ -470,14 +470,14 @@ Client.prototype.downloadFile = function(params) {
470470
downloader.progressTotal += chunk.length;
471471
downloader.progressAmount += chunk.length;
472472
downloader.emit('progress');
473-
outStream.write(chunk);
473+
outStream.write(chunk);
474474
})
475475

476-
request.on('httpDone', function() {
476+
request.on('httpDone', function() {
477477
if (errorOccurred) return;
478478
downloader.progressAmount += 1;
479479
downloader.emit('progress');
480-
outStream.end();
480+
outStream.end();
481481
cb();
482482
})
483483
} else {
@@ -1169,7 +1169,9 @@ function syncDir(self, params, directionIsToS3) {
11691169
function startUpload() {
11701170
ee.progressTotal += localFileStat.size;
11711171
var fullKey = prefix + localFileStat.s3Path;
1172-
upDownFileParams.s3Params.Key = fullKey;
1172+
if (!upDownFileParams.s3Params.Key) {
1173+
upDownFileParams.s3Params.Key = fullKey;
1174+
}
11731175
upDownFileParams.localFile = fullPath;
11741176
var uploader = self.uploadFile(upDownFileParams);
11751177
var prevAmountDone = 0;

0 commit comments

Comments
 (0)