-
Notifications
You must be signed in to change notification settings - Fork 889
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
Progress listener Total is 0 with large files #328
Comments
I have the same problem. Has anyone written something special for Electron? |
I also have the same problem. Is it solved? |
Not all download requests signals the client how many bytes there are to be downloaded. Generally speaking the server must send a In the case of electron/browser platform, the underlying implementation is the browser XMLHttpRequest API itself, and For iOS/Android platform, Cordova looks for the It's up to the application to check the I don't believe this is a bug but I won't close this issue just yet. If someone can demonstrate this issue occurring on android/ios on a download request in which provides a |
Thanks, I think that suggests that your server end-point is indeed sending the If it's missing by the time it reaches the standard browser/postman, then the header could be getting lost between the client and the server application and would explain why the client won't have a computable length. If it's also present in postman, then Cordova should be receiving it as well. In this case, please let us know what platforms you're observing this issue (Android, iOS, etc..) |
Thanks, This issus appears in Android. |
Actually, this is probably because we use getContentLength when generating progress events here. the There is a long version of the API but returning a long to the webview is dangerous because it exceeds the max safe integer of the javascript engine. If the file size is between Despite this danger, it seems like iOS is using long long in it's implementation. The JS |
Thanks so much, this will solve a tricky problem for me! @breautek |
Bug Report
Problem
The "total" property of ProgressEvent Interface equals zero when downloading large file (ex: 6 gig)
interface ProgressEvent extends Event {
readonly lengthComputable: boolean;
readonly loaded: number;
readonly target: T | null;
readonly total: number;
}
What is expected to happen?
total property should be equal to file size
What does actually happen?
total = 0 when downloading large file (tested with 6.6 gig file)
loaded goes up to the file size so it's not a data type problem and total has correct filesize with smaller files
Information
download a large file (ex: 6 gig) and set onProgress listener
Command or Code
let currentProgress
ft.onProgress((evt:ProgressEvent)=> {
currentProgress = (evt.loaded / evt.total) <-- currentProgress = "Infinity" since evt.total = 0
})
Environment, Platform, Device
Android 10 - ionic-native - cordova
Version information
Android 10
Cordova 9
"cordova-plugin-file-transfer": "git+https://github.com/apache/cordova-plugin-file-transfer.git",
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer/ngx';
Ionic 5.4.15
Win10
VSCode Version: 1.56.2 (system setup)
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.18363
Checklist
The text was updated successfully, but these errors were encountered: