Skip to content

Instantly share code, notes, and snippets.

@triloknagvenkar
Created December 11, 2018 16:22
Show Gist options
  • Save triloknagvenkar/00570b1ef9f7b529d21dfede9df5b8c4 to your computer and use it in GitHub Desktop.
Save triloknagvenkar/00570b1ef9f7b529d21dfede9df5b8c4 to your computer and use it in GitHub Desktop.
Initiates a multipart upload and returns an upload ID.
/*
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