2017-10-07 251 views
0

我對Ionic真的很陌生,所以這可能是一個簡單的,但我還不知道它。所以請幫助
我想從Google下載文件夾從我的應用程序驅動到Android/Ios並在應用程序中使用它。 我以爲我可以使用相同的代碼,這是用來下載一個普通的文件,但它不工作。我使用如何下載文件夾使用Cordova fileTransfer到Android或Ios設備

守則---

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, 

function(directory) { 
      var fileTransfer = new FileTransfer(); 
      console.log(directory.root); 
      fileTransfer.download(
       encodeURI("https://drive.google.com/open?id=0B6tGuVQgFM6vM1Rjelsdadadaas"), 
       directory.root.nativeURL + 'course1', 
       function(entry) { 
        console.log("download complete: " + entry.fullPath); 
        }, 
       function(error) { 
        console.log(error); 
        console.log("download error source " + error); 
        console.log("download error target " + error.target); 
        console.log("upload error code" + error.code); 
       }, 
       false 
     ); 
     }, function(err){console.error(err)}); 

我沒有得到任何錯誤,但沒有看到我的項目名稱/文件/文件夾內的任何新的文件在我的Android設備。

請幫幫忙,我想下載一個完整的文件夾/或如果是好下載一個ZIP並將其解壓縮到某個位置?/

請建議。

在此先感謝

回答

0

使用CordovaFileTransfer您無法下載文件夾。您需要將文件夾保存爲zip或tar格式,然後才能下載。

相關問題