rn-fetch-blob icon indicating copy to clipboard operation
rn-fetch-blob copied to clipboard

Download doesn't work or showing wrong progress

Open iphonic opened this issue 2 years ago • 2 comments

Hi, Using library version 0.12.0. Facing two issues, both with downloading, issues are

  1. Download doesn't work with internal redirection with some specific endpoint URL which have redirections
  2. 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.

iphonic avatar Mar 26 '22 19:03 iphonic

same issues rn-fetch-blob: "0.13.0-beta-1"

lucaslz2020 avatar Apr 14 '22 07:04 lucaslz2020

total is -1, either because your url is incorrect or because the file isn't currently available.

ZexinW avatar Apr 04 '23 02:04 ZexinW