Download a file to Downloads folder of device using Cordova FileTransfer

前端 未结 1 479
面向向阳花
面向向阳花 2020-12-20 21:21

I am using Cordova FileTransfer object to download a file from a url to device.

var fileTransfer = new FileTransfer();
var path = cordova.file.dataDirectory         


        
相关标签:
1条回答
  • 2020-12-20 21:54

    In Cordova, with FileTransfer, you can request TEMPORARY or PERSISTENT file system

    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
    window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail);
    
    • iOS
      • PERSISTENT will return the Documents directory,
      • TEMPORARY will return the Caches directory
    • Android
      • PERSISTENT will returns the root of the SD card/phone memory
      • TEMPORARY will return a folder inside the data folder.

    Refer File API & FileTransfer for more info.

    0 讨论(0)
提交回复
热议问题