Getting Started
react-native-nitro-unzip provides high-performance ZIP extraction and compression for React Native, powered by Nitro Modules.
Requirements
| Requirement | Version |
|---|---|
| React Native | 0.75+ |
| Nitro Modules | 0.34+ |
| iOS | 15.5+ |
| Android SDK | 21+ |
| Java (Android) | 17 |
New Architecture Required
This library requires React Native's New Architecture (Fabric + TurboModules) as it is built on Nitro Modules.
Installation
npm install react-native-nitro-unzip react-native-nitro-modules
iOS
cd ios && pod install
The underlying SSZipArchive dependency requires iOS 15.5+. Set your deployment target accordingly:
- Bare React Native: in
ios/Podfile, setplatform :ios, '15.5'. - Expo: in
ios/Podfile.properties.json, add"ios.deploymentTarget": "15.5"(or use theexpo-build-propertiesplugin withios.deploymentTarget: "15.5").
Android
No additional setup needed — the library auto-links with React Native. Your app must be built with Java 17 (the RN 0.73+ default).
Quick Start
import { getUnzip } from 'react-native-nitro-unzip';
// Create an Unzip instance
const unzip = getUnzip();
// Extract a ZIP archive
const task = unzip.extract('/path/to/archive.zip', '/path/to/output');
task.onProgress((p) => {
console.log(`${(p.progress * 100).toFixed(0)}% — ${p.extractedFiles}/${p.totalFiles} files`);
});
const result = await task.await();
console.log(`Extracted ${result.extractedFiles} files in ${result.duration}ms`);
The getUnzip() function creates an Unzip factory instance. From there you can create extraction tasks, compression tasks, and more. Each task is an independent, observable, and cancellable operation.
Next Steps
- Extraction — extracting ZIP archives with progress tracking
- Compression — creating ZIP archives from directories
- Password Protection — working with encrypted archives
- Cancellation — cancelling in-progress operations