2017-06-20 237 views
0

我只希望我的應用程序使用react-native-fetch-blob從服務器上下載文件。問題是,文件存儲在哪裏?我剛剛從CONSOLE.LOG反應原生取二進制大對象的回調得到這個對象React-native-fetch-blob下載文件

React-native-fetch-blob object callback

這是我的代碼

alert("downloading"); 
RNFetchBlob 
    .config({ 
     useDownloadManager : true, 
     fileCache : true 
    })  
    .fetch('GET', 'http://fontawesome.io/assets/font-awesome-4.7.0.zip', {}) 
    .then((res) => { 

     console.log(res); 
     alert("Download"); 
     alert('The file saved to ', res.path()); 
    }) 

任何解決方案?

回答

0

我正在使用它,它完美的作品。 你只需要得到這樣的路徑。

var filePath = res.path(); 

這是存儲文件的位置。

+0

我這樣做之前,但它返回空字符串 –

+1

我的顯示空。 – quantumpotato