I am trying to download a small image using this particular code snippet :
Plug in Used : "rn-fetch-blob": "^0.10.14"
RNFetchBlob.
config({
fileCache: true,
}).
fetch('GET', url, { //getting image URL from server
// some headers ..
})
.then((response) => {
const base64Str = response.data;
RNFetchBlob.fs
.writeFile(imageLocation, base64Str, 'base64')
.then(() => {
console.log("Download successful");
}).catch((err) => {
console.log('Failed to save file. ', err);
});
variable imageLocation points to ${RNFetchBlob.fs.dirs.DocumentDir}/${filename}
.
Also tried with ${RNFetchBlob.fs.dirs.CacheDir}/${filename}
.
Download is successful but no image is shown in device photos.