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

Commit

Permalink
allow Key override at getS3Params()
Browse files Browse the repository at this point in the history
  • Loading branch information
beneidel committed Jan 21, 2016
1 parent d0946f6 commit 7c5074c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ Client.prototype.downloadFile = function(params) {
if (statusCode >= 300) {
handleError(new Error("http status code " + statusCode));
return;
}
}
if (headers['content-length'] == undefined) {
var outStream = fs.createWriteStream(localFile);
outStream.on('error', handleError);
Expand All @@ -470,14 +470,14 @@ Client.prototype.downloadFile = function(params) {
downloader.progressTotal += chunk.length;
downloader.progressAmount += chunk.length;
downloader.emit('progress');
outStream.write(chunk);
outStream.write(chunk);
})

request.on('httpDone', function() {
request.on('httpDone', function() {
if (errorOccurred) return;
downloader.progressAmount += 1;
downloader.emit('progress');
outStream.end();
outStream.end();
cb();
})
} else {
Expand Down Expand Up @@ -1169,7 +1169,11 @@ function syncDir(self, params, directionIsToS3) {
function startUpload() {
ee.progressTotal += localFileStat.size;
var fullKey = prefix + localFileStat.s3Path;
upDownFileParams.s3Params.Key = fullKey;
if (!upDownFileParams.s3Params.Key) {
upDownFileParams.s3Params.Key = fullKey;
} else {
fullKey = upDownFileParams.s3Params.Key;
}
upDownFileParams.localFile = fullPath;
var uploader = self.uploadFile(upDownFileParams);
var prevAmountDone = 0;
Expand Down

0 comments on commit 7c5074c

Please sign in to comment.