https://github.com/didisouzacosta/uncompress-react-native
Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.
https://github.com/didisouzacosta/uncompress-react-native
cbr cbz decompress-library rar react-native typescript zip
Last synced: 8 months ago
JSON representation
Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.
- Host: GitHub
- URL: https://github.com/didisouzacosta/uncompress-react-native
- Owner: didisouzacosta
- License: mit
- Created: 2021-04-18T10:04:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-07T06:47:34.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T15:44:29.856Z (8 months ago)
- Topics: cbr, cbz, decompress-library, rar, react-native, typescript, zip
- Language: Kotlin
- Homepage:
- Size: 38.8 MB
- Stars: 46
- Watchers: 1
- Forks: 3
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react - uncompress-react-native - Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native. ` 📝 a month ago` (React Native [🔝](#readme))
- awesome-react-cn - uncompress-react-native - Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native. (Uncategorized / Uncategorized)
README
# Uncompress React Native

[](https://codecov.io/gh/didisouzacosta/uncompress)
[](https://opensource.org/licenses/MIT) [](CONTRIBUTING.md)
Simple library to decompress files `.zip`, `.rar`, `.cbz` and `.cbr` in React Native.
## Installation
```sh
yarn add uncompress-react-native
or
npm install uncompress-react-native
```
## iOS Pods installation
After installing the library, you can install pods using the command: `cd ios && pod install && cd ..`
• If you will have problems with the installation of the dependency `UnrarKit`, you need add in your Podfile `use_frameworks!`
• If you will have problems with `[CP-User] Generate Specs` after add `use_frameworks!`, you can modify your `post_install` to fix.
[The solution discussion reference](https://github.com/facebook/react-native/issues/31034#issuecomment-812564390)
```ruby
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
end
```

## Usage
```js
import Uncompress from 'uncompress-react-native';
// ...
await Uncompress.extract({
filePath: 'temp/sample_comic.cbr',
destination: 'data/comic',
});
// ...
```
## Extract protected file
```js
// ...
await Uncompress.extract({
filePath: 'temp/sample_protected_comic.cbr',
destination: 'data/comic',
password: '123',
});
// ...
```
## Override files after extraction if successful
```js
// ...
await Uncompress.extract({
filePath: 'temp/sample_protected_comic.cbr',
destination: 'data/comic',
override: true,
});
// ...
```
## Checks whether the file is password protected
```js
// ...
const isProtected = await Uncompress.isProtected({
filePath: 'temp/sample_protected_comic.cbr',
});
console.log(isProtected);
// ...
```
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## Credits
1. [UnrarKit](https://github.com/abbeycode/UnrarKit)
2. [SSZipArchive](https://github.com/ZipArchive/ZipArchive)
3. [slf4j](https://github.com/qos-ch/slf4j)
4. [junrar](https://github.com/junrar/junrar)
## License
[MIT](LICENSE)