rn-fetch-blob
rn-fetch-blob copied to clipboard
Download doesn't work or showing wrong progress
Hi, Using library version 0.12.0. Facing two issues, both with downloading, issues are
- Download doesn't work with internal redirection with some specific endpoint URL which have redirections
- Download works, but download progress is wrong, always receiving total - 1
Following is the code we trying, please point out mistake
var parameters={appver:"1",osver:"android",ver:"7",token:"sessiontoken"}
var headers={"X-API-KEY":apikey,"X-USER-KEY":userkey,"Accept": 'multipart/form-data' }
const dirs = RNFetchBlob.fs.dirs
const downloadpath=`${dirs.DocumentDir}/${filename}`
RNFetchBlob.config({
path:downloadpath,
fileCache:true,
})
.fetch('POST',url,{
...headers
},
JSON.stringify(parameters)
)
.progress((received,total)=>{
console.log("received ",received);
console.log("TOTAL ",total); // <=========== Receiving -1 always
console.log('progress', received / total)
})
.then((res)=>{
console.log(res);
})
.catch((err)=>{
console.log(err);
})
Thanks for Help.
same issues rn-fetch-blob: "0.13.0-beta-1"
total is -1, either because your url is incorrect or because the file isn't currently available.