1.5.5 • Published 10 years ago

cordova-plugin-pause-resume-download v1.5.5

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

build pass

cordova-plugin-pause-resume-download

Use the way Pause & Resume to download files for Cordova/PhoneGap

扩展CordovaFilePlugin,断点续下载

Demo Preview

Just clone and install this demo. cordova-plugin-pause-resume-download-DEMO :tada:

  • 如果喜欢它,请别忘了给我一颗鼓励的星
  • Support me a Star if it is necessary. :+1:

PRD-Demo

Platforms

  • Android
  • iOS

How-to

Use new PRD() instead of new FileTransfer()

and the rest of usage is the same as cordova-plugin-file-transfer # download.

//var fileTransfer = new FileTransfer();
  var fileTransfer = new PRD();  // Use PRD ( extended cordova-plugin-pause-resume-download )

var uri = encodeURI("http://some.server.com/download.php");

fileTransfer.download(
    uri,
    fileURL,
    function(entry) {
        console.log("download complete: " + entry.toURL());
    },
    function(error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code" + error.code);
    },
    false,
    {
        headers: {
            "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
        }
    }
);

fileTransfer.onprogress = function(progress) {
    console.log(progress.loaded, progress.total);
    
    /*if (this.pre === undefined) this.pre = 0;

    var now = ~~((progress.loaded / progress.total) * 100 * 100);
    if (now - +this.pre > 17) {
        updateProgress(now / 100);
        this.pre = now;
    }*/
}

Thanks my friend @Jason @BlackSi

1.5.5

10 years ago

1.5.4

10 years ago

1.5.3

10 years ago

1.5.2

10 years ago

1.5.1

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago