Interface: Unzip
Defined in: src/specs/Unzip.nitro.ts:152
Factory for creating extraction and compression tasks.
Example
import { getUnzip } from 'react-native-nitro-unzip'
const unzip = getUnzip()
// Extract
const task = unzip.extract('/path/to/archive.zip', '/path/to/output')
task.onProgress((p) => console.log(`${(p.progress * 100).toFixed(0)}%`))
const result = await task.await()
// Extract with password
const pwTask = unzip.extractWithPassword('/path/to/encrypted.zip', '/output', 'secret')
const pwResult = await pwTask.await()
// Create zip
const zipTask = unzip.zip('/path/to/folder', '/path/to/output.zip')
const zipResult = await zipTask.await()
Extends
HybridObject<{android:"kotlin";ios:"swift"; }>
Properties
name
readonlyname:string
Defined in: node_modules/react-native-nitro-modules/lib/typescript/HybridObject.d.ts:52
The HybridObject's name.
Inherited from
HybridObject.name
Methods
dispose()
dispose():
void
Defined in: node_modules/react-native-nitro-modules/lib/typescript/HybridObject.d.ts:94
Disposes any resources this HybridObject might hold natively,
and releases this HybridObject's NativeState.
After calling (), this object can no longer be used.
Eagerly disposing a HybridObject could be beneficial for a queue-/handler-architecture
where a bunch of Hybrid Objects are allocated, and later deallocated once a callback (e.g. a render function)
completes.
Returns
void
Note
It is NOT required to call () manually, as the JavaScript
Garbage Collector automatically disposes and releases any resources when needed.
It is purely optional to eagerly-, and manually-, call () here - use with caution!
Inherited from
HybridObject.dispose
equals()
equals(
other):boolean
Defined in: node_modules/react-native-nitro-modules/lib/typescript/HybridObject.d.ts:79
Returns whether this HybridObject is the same object as other.
While two HybridObjects might not be equal when compared with ==, they might still
hold the same underlying HybridObject, in which case equals(other)
will return true.
Parameters
| Parameter | Type |
|---|---|
other | HybridObject<{ android: "kotlin"; ios: "swift"; }> |
Returns
boolean
Example
const hybridA = SomeModule.getExistingHybridInstance()
const hybridB = SomeModule.getExistingHybridInstance()
console.log(hybridA.equals(hybridB)) // true
Inherited from
HybridObject.equals
extract()
extract(
zipPath,destinationPath):UnzipTask
Defined in: src/specs/Unzip.nitro.ts:161
Start extracting a ZIP archive to the given destination directory.
Returns an UnzipTask instance for progress tracking and cancellation.
Parameters
| Parameter | Type | Description |
|---|---|---|
zipPath | string | Absolute path to the ZIP file (file:// URIs accepted) |
destinationPath | string | Absolute path to extract into (created if missing) |
Returns
extractWithPassword()
extractWithPassword(
zipPath,destinationPath,password):UnzipTask
Defined in: src/specs/Unzip.nitro.ts:170
Extract a password-protected ZIP archive.
Parameters
| Parameter | Type | Description |
|---|---|---|
zipPath | string | Absolute path to the ZIP file |
destinationPath | string | Absolute path to extract into |
password | string | Password for the encrypted archive |
Returns
toString()
toString():
string
Defined in: node_modules/react-native-nitro-modules/lib/typescript/HybridObject.d.ts:64
Returns a string representation of the given HybridObject.
Unless overridden by the HybridObject, this will return the name of the object.
Returns
string
Example
const hybridA = SomeModule.getExistingHybridInstance()
console.log(hybridA.toString()) // [HybridObject HybridA]
Inherited from
HybridObject.toString
zip()
zip(
sourcePath,destinationZipPath):ZipTask
Defined in: src/specs/Unzip.nitro.ts:182
Create a ZIP archive from a directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
sourcePath | string | Absolute path to the directory to compress |
destinationZipPath | string | Absolute path for the output ZIP file |
Returns
zipWithPassword()
zipWithPassword(
sourcePath,destinationZipPath,password):ZipTask
Defined in: src/specs/Unzip.nitro.ts:192
Create a password-protected ZIP archive from a directory. Uses AES-256 encryption on Android, standard zip encryption on iOS.
Parameters
| Parameter | Type | Description |
|---|---|---|
sourcePath | string | Absolute path to the directory to compress |
destinationZipPath | string | Absolute path for the output ZIP file |
password | string | Password to protect the archive |