React native android Error: org.apache.commons.compress.compressors.CompressorException: Could not create CompressorInputStream

React native android Error: org.apache.commons.compress.compressors.CompressorException: Could not create CompressorInputStream

我正在使用 react-native-archiver 提取 tar 文件。

   const targetPath = ExternalDirectoryPath;
   RNArchiver.untar(ExternalDirectoryPath + '/content.tar', targetPath)
     .then(path => {
       console.log(`untar completed at ${path}`)
     })
     .catch(error => {
       console.error(error)
     })

我在 android 上有这个错误:

Error: org.apache.commons.compress.compressors.CompressorException: Could not create CompressorInputStream.

我设法通过更改节点模块内 RNArchiverModule.java 中的这一行代码来解决问题 -> react-native-archiver ->android

发件人:

Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR, CompressionType.GZIP); 

收件人:

 Archiver archiver = ArchiverFactory.createArchiver(ArchiveFormat.TAR);

正在提取 tar.gz 而不是 tar。

但库仍然不支持 ios,我需要为此找到解决方案吗?