itinance / itinance/react-native-fs

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

Open
#1,120 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

` 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);
};`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.