Skip to content

Instantly share code, notes, and snippets.

@triloknagvenkar
Created December 11, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triloknagvenkar/647b632e91a73b4ea77245b2108a4d9a to your computer and use it in GitHub Desktop.
Save triloknagvenkar/647b632e91a73b4ea77245b2108a4d9a to your computer and use it in GitHub Desktop.
Uploads a part in a multipart upload.
/*
Uploads a part in a multipart upload.
The following code uploads part of a multipart upload.
it specifies a file name for the part data. The Upload ID is same that is returned by the initiate multipart upload.
*/
continueMultiUpload(audioBlob, PartNumber, uploadId, key, bucketName) {
var self = this;
var params = {
Body: audioBlob,
Bucket: bucketName,
Key: key,
PartNumber: PartNumber,
UploadId: uploadId
};
console.log(params);
self.s3.uploadPart(params, function(err, data) {
if (err) {
console.log(err, err.stack)
} // an error occurred
else {
/*
Once the part of data is uploaded we get an Entity tag for the uploaded object(ETag).
which is used later when we complete our multipart upload.
*/
self.etag.push(data.ETag);
if (self.booleanStop == true) {
self.completeMultiUpload();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment