#react-native #zipfile
#react-native #zip
Вопрос:
У меня есть приложение react native, в котором загрузка tar-файла загружается с URL, сохраняет его на устройстве и после этого считывает с него файлы. Я использовал rn-fetch-blob и react-native-zip-archive, и я смог загрузить zip-файл и извлечь его. Однако с tar-файлом он никогда не работает со мной. Любое решение или другие предложения библиотеки github?
import { zip, unzip, unzipAssets, subscribe } from 'react-native-zip-archive'
import RNFetchBlob from 'rn-fetch-blob'
.....
.....
onDownloadedtionPress() {
RNFetchBlob.config({
fileCache: true,
path: DocumentDirectoryPath '/my.tar',
})
.fetch('GET', 'https://file-examples-com.github.io/uploads/2017/02/zip_5MB.zip')
.then(res => {
console.log(res);
const targetPath = DocumentDirectoryPath
unzip(res.path(), targetPath)
.then(path => {
console.log(`unzip completed at ${path}`)
})
.catch(error => {
console.error(error)
})
})
}