apache / apache/cordova-plugin-file-transfer
Progress listener Total is 0 with large files
- Dominant language
- JavaScript
- Stars
- 606
- Forks
- 874
- PR merge metrics
- No merged PRs in 30d
Description
# 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
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start by reproducing the onProgress behavior while downloading a file around 6.6 GB on Android, then trace the plugin's progress reporting from the FileTransferObject.onProgress listener. Confirm that loaded continues increasing while total remains zero, and consider the issue done when total reports the file size for large downloads without producing an infinite progress calculation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100