Я создаю приложение на основе реактивного интерфейса. Приложение состоит из различных курсов.Эти курсы доступны в автономном режиме. С помощью response-native-fs, как я могу скачать 2 или более курсов одновременно?
import { Platform } from "react-native";
import RNFetchBlob from 'rn-fetch-blob'
import { _unzipAll } from "@lib/unZip";
import { DocumentDirectoryPath, LibraryDirectoryPath } from "react-native-fs";
import {
DOWNLOADED_FILE_PATH,
DOWNLOADED_FILE_DIRECTORY
} from "@config/constants";
let parentPath =
Platform.OS === "ios" ? LibraryDirectoryPath : DocumentDirectoryPath;
export function downloadAllFileZip(targetPath, props, id) {
console.log("props id val",id);
console.log("download alll lib", props.courseofflineurl);
try {
RNFetchBlob.config({
path: targetPath
})
.fetch(
"GET",
props.courseofflineurl
)
.progress((received, total) => {
percentage = Math.ceil((received / total) * 100);
console.log("percentage" + percentage)
// getDetails(percentage);
})
.then(res => {
console.log("Downloadedd", res)
_unzipAll(targetPath, parentPath + DOWNLOADED_FILE_DIRECTORY + id, props,id);
})
.catch(error => { });
} catch (error) { }
}