-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding download progress tracker for Storage.get #8295
Adding download progress tracker for Storage.get #8295
Conversation
Codecov Report
@@ Coverage Diff @@
## main #8295 +/- ##
=======================================
Coverage 77.96% 77.96%
=======================================
Files 237 237
Lines 16824 16836 +12
Branches 3614 3616 +2
=======================================
+ Hits 13116 13126 +10
- Misses 3582 3584 +2
Partials 126 126
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled and tested (manually). Seems to work as advertised!
Is there an associated integ test PR?
Thanks! Not yet, will add it and reference it here! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good @jamesaucode !
I have a couple of questions if you can review those
Thanks again!
@@ -265,6 +271,18 @@ export class AWSS3Provider implements StorageProvider { | |||
if (download === true) { | |||
const getObjectCommand = new GetObjectCommand(params); | |||
try { | |||
if (progressCallback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is axios downloader not the browser downloader right?, where is this stored I don't remember how this worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is for the use case of when user calls Storage.get('key', { download:true })
where the user wants the Blob
directly.
progressCallback
will be called whenever the onDownloadProgress
event fires from axios
(which seems to be the progress event from XMLHttpRequest
https://github.com/axios/axios/blob/master/lib/adapters/xhr.js#L159)
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Description of changes
This adds a download tracker for
.get
similar to.put
. Also changedSEND_PROGRESS
toSEND_UPLOAD_PROGRESS
to remove ambiguity.Added a small test to verify the cancelToken from the last PR's
.cancel
API gets properly added to the requestDoc change PR in #3238
Issue #, if available
fixes #4734
Description of how you validated changes
Added relevant unit tests, manually tested.
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.