You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to download and show loading progress with javascript on web page, but when I'm serving with pm2 serve, there is no way to get the total size of a file downloaded with XmlHttpRequest.
How could we reproduce this issue?
serve some files with pm2 serve
in js file:
let xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = responseType || 'blob';
xhr.onprogress = function(p) {
let contentLength = xhr.getResponseHeader('x-decompressed-content-length')
let contentLength2 = xhr.getResponseHeader('Content-Length')
console.warn(p.loaded, p.total, p.lengthComputable, contentLength, contentLength2)
};
xhr.send(null);
after funning the js above, the progress info will be logged, and only p.loaded is available so there is no way to calculate the percentage of the loading progress. And by looking into the network tab of the devtool, it can be seen the 'transfer-encoding' is 'chunked' and the 'content-length' is not set.
Supporting information
# Run the following commands
$ pm2 report
The text was updated successfully, but these errors were encountered:
What's going wrong?
I need to download and show loading progress with javascript on web page, but when I'm serving with
pm2 serve
, there is no way to get the total size of a file downloaded with XmlHttpRequest.How could we reproduce this issue?
pm2 serve
p.loaded
is available so there is no way to calculate the percentage of the loading progress. And by looking into the network tab of the devtool, it can be seen the 'transfer-encoding' is 'chunked' and the 'content-length' is not set.Supporting information
The text was updated successfully, but these errors were encountered: