react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

Using react-native-fs for downloading a mp3 or png files, is very slow.

Open faizkhan7896 opened this issue 3 years ago • 0 comments

` const downloadImage = async () => { setLoading(true); console.log(startsurah.mp3); await RNFS.downloadFile({ discretionary: true, progress: (res: DownloadProgressCallbackResult) => { console.log("Response written ==="); let progressPercent = (res.bytesWritten / res.contentLength) * 1; // to calculate in percentage console.log("progress===", progressPercent); setProgress({progress: progressPercent.toFixed(2)}); // downloadFileProgress = progressPercent; console.log(res); }, fromUrl: startsurah.mp3,

  toFile: `/sdcard/Android/data/com.aljazeera/files/auds/${startsurah.title}.mp3`,
}).promise.then(r => {
  console.log(RNFS.DocumentDirectoryPath);
});
setLoading(false);
ShowToast("Surah Downloaded Successfully");
setProgress(0);

};`

faizkhan7896 avatar Jul 29 '22 13:07 faizkhan7896