Created
December 11, 2018 16:22
-
-
Save triloknagvenkar/00570b1ef9f7b529d21dfede9df5b8c4 to your computer and use it in GitHub Desktop.
Initiates a multipart upload and returns an upload ID.
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
/* | |
Initiates a multipart upload and returns an upload ID. | |
Upload id is used to upload the other parts of the stream | |
*/ | |
startMultiUpload(blob, filename) { | |
var self = this; | |
var audioBlob = blob; | |
var params = { | |
Bucket: self.bucketName, | |
Key: filename, | |
ContentType: 'audio/webm', | |
ACL: 'private', | |
}; | |
self.s3.createMultipartUpload(params, function(err, data) { | |
if (err) { | |
console.log(err, err.stack); // an error occurred | |
} else { | |
self.uploadId = data.UploadId | |
self.incr = 1; | |
self.continueMultiUpload(audioBlob, self.incr, self.uploadId, self.filename, self.bucketName); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment