onDownloadProgress has progressEvent.total property with zero value
See original GitHub issueI’ve the simplest code like
onDownloadProgress: function(progressEvent) {
console.log('download', progressEvent);
},
It returns object with total: 0
property.
Is there are any way to obtain total
property with correct value?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:19
- Comments:14 (2 by maintainers)
Top Results From Across the Web
How can I get the onDownloadProgress percentage with axios ...
onDownloadProgress (progressEvent) { const percentage ... Simply the jsonplaceholder api doesn't have progress value for the get request .
Read more >ProgressEvent.total - Web APIs | MDN
The ProgressEvent.total read-only property is an unsigned 64-bit integer value indicating the total size of the data being processed or ...
Read more >Axios onDownloadProgress Example - CodeSandbox
CodeSandbox is an online editor tailored for web applications.
Read more >此框架下axios onDownloadProgress 功能失效单页面正常#2512
onDownloadProgress has progressEvent.total property with zero value ` axios.get('https://32323233.oss-cn-beijing.aliyuncs.com/1.pdf', { onDownloadProgress: ...
Read more >axios show download progress Code Example - Code Grepper
const config = { onUploadProgress: progressEvent ... //get use the onDownloadProgress, other requests use the onUploadProgress.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Axios binds the
onDownloadProgress
function directly to nativeprogress
event of thexmlhttprequest
instance: xhr.js#L145. The problem is in gzipped responses. Chrome for example has always for such responseslengthComputet=false
andtotal=0
. This makes also sens, astotal
reports the size of the content itself, and browsers can’t predict how many bytes will be the content.loaded
reports the size after decoding, so even if you read thecontent-length
header withat some point you will get
loaded > contentLength
. A workaround would be to send the actual size in headers, smth. likeX-Actual-Content-Length
and then read the correct size inonDownloadProgress
.Ensure that your server is sending the Content-Length response header