Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Return total file size

  • Loading branch information...
commit 739f8ec718208952dbe0ab1fd04cd093165a81db 1 parent 778bd09
@nathanoehlman authored
Showing with 4 additions and 1 deletion.
  1. +3 −1 lib/multipartupload.js
  2. +1 −0  test/multipart.js
View
4 lib/multipartupload.js
@@ -226,8 +226,9 @@ MultiPartUpload.prototype._completeUploads = function(callback) {
if (err) return callback(err);
- var parts, body;
+ var size = 0, parts, body;
parts = _.map(results, function(value) {
+ size += value.size;
return util.format('<Part><PartNumber>%d</PartNumber><ETag>%s</ETag></Part>', value.part, value.etag);
}).join('');
@@ -237,6 +238,7 @@ MultiPartUpload.prototype._completeUploads = function(callback) {
parse.xmlResponse(req, function(err, body) {
if (err) return callback(err);
delete body.$;
+ body.size = size;
mpu.emit('completed', body);
return callback(null, body);
});
View
1  test/multipart.js
@@ -103,6 +103,7 @@ describe('Knox multipart form uploads', function() {
mpu = new MultiPartUpload(opts, function(err, body) {
if (err) return done(err);
assert.equal(body['Key'], opts.objectName);
+ assert.equal(body.size, 6242880);
// Clean up after ourselves
client.deleteFile(opts.objectName, function(err, res) {
Please sign in to comment.
Something went wrong with that request. Please try again.