madhukar kumar
madhukar kumar

Reputation: 85

how to get the size of file/folder being downloaded in phonegap

I am developing an android app and using phonegap 2.6.0 What I want to do is to download a file/folder. I want the size of file portion that is being downloaded. Any help?

Upvotes: 2

Views: 985

Answers (1)

whodeee
whodeee

Reputation: 657

check out FileTransfer.onprogress

fileTransfer.onprogress = function(progressEvent) {
    if (progressEvent.lengthComputable) {
      loadingStatus.setPercentage(progressEvent.loaded / progressEvent.total);
    } else {
      loadingStatus.increment();
    }
};
fileTransfer.download(...); // or fileTransfer.upload(...);

I think what you are looking for is progressEvent.total

Upvotes: 1

Related Questions