【发布时间】:2017-02-13 18:34:33
【问题描述】:
我正在使用 react-native-fetch-blob 下载 excel 文件,这些文件存储在我无法在 iphone 中打开的 app/documents 文件夹中,而且我不知道 iphone 文档文件夹的绝对路径将文件保存在那里。
这是我的代码:
downloadFile(){
const dirs = RNFetchBlob.fs.dirs;
let context = this,
userBarRelationId = context.state.userBarId;
RNFetchBlob
.config({
fileCache : true,
path : dirs.DocumentDir + '/excel.xlsx'
})
.fetch('GET', 'http://localhost:5000/getExcel/'+userBarRelationId, {
})
.then((res) => {
console.log('The file saved to ', res.path(), res.data)
})
}
【问题讨论】:
标签: javascript ios iphone reactjs react-native