0

I am using AWS javascript SDK to upload a file to S3 using multipart upload.

// Use S3 ManagedUpload class as it supports multipart uploads
  var upload = new AWS.S3.ManagedUpload({
    params: {
      Bucket: albumBucketName,
      Key: photoKey,
      Body: file,
      ACL: "public-read"
    }
  });

But I would like to also show the speed at which the upload is happening in the UI. Document doesn't provide any API to get the speed. So would like to know how to calculate the upload speed.

regards Achuth

1 Answer 1

1
.on('httpUploadProgress', function(e) {
   console.log(e.loaded);
});

You can use .on listner , and e.loaded will provide you the uploaded bytes value, which can be used to calculate percentage of upload.

new AWS.S3.ManagedUpload({
    params: {
      Bucket: albumBucketName,
      Key: photoKey,
      Body: file,
      ACL: "public-read"
    }
}).on('httpUploadProgress', function(e) {
  console.log(e.loaded);
});
Sign up to request clarification or add additional context in comments.

2 Comments

upload progress is fine, I need to find the upload speed.
You need to calculate the upload speed yourself. Calculate the difference between two successive events and get the speed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.