RNFetchBlob
.config({
addAndroidDownloads: {
useDownloadManager: true,
//changes here
path: RNFetchBlob.fs.dirs.SDCardApplicationDir + '/build_change_philippines.zip',
description: 'Images Zip',
mediaScannable: true
}
})
.fetch('GET', 'http://bccms.naxa.com.np/core/project-material-photos/1')
.then((resp) => {
const sourcePath = resp.path();
const targetPath = resp.path().replace('.zip', '');
unzip(sourcePath, targetPath)
.then((path) => {
console.log(`unzip completed at ${path}`);
})
.catch((error) => {
console.log(error);
});
});
对于大文件大小(超过 80 兆字节),上面的代码片段开始下载,但显示Untitled并且没有进展,然后显示Unsuccessful。下载会自动重新开始,循环继续进行。但是相同的代码可以轻松下载小 zip 文件。