Created
December 11, 2018 16:24
-
-
Save triloknagvenkar/f631bf93a4b194a02d0acd19abc7d4b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Completes a multipart upload by assembling previously uploaded parts. | |
*/ | |
completeMultiUpload() { | |
var self = this; | |
var outputTag = []; | |
/* | |
here we are constructing the Etag data in the required format. | |
*/ | |
self.etag.forEach((data, index) => { | |
const obj = { | |
ETag: data, | |
PartNumber: ++index | |
}; | |
outputTag.push(obj); | |
}); | |
var params = { | |
Bucket: self.bucketName, // required | |
Key: self.filename, // required | |
UploadId: self.uploadId, // required | |
MultipartUpload: { | |
Parts: outputTag | |
} | |
}; | |
self.s3.completeMultipartUpload(params, function(err, data) { | |
if (err) { | |
console.log(err, err.stack) | |
} // an error occurred | |
else { | |
// initialize variable back to normal | |
self.etag = [], self.recordedChunks = []; | |
self.uploadId = ""; | |
self.booleanStop = false; | |
self.disableAllButton(); | |
self.removeLoader(); | |
alert("we have successfully saved the questionaire.."); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment