Skip to main content

Interface: Unzip

Defined in: src/specs/Unzip.nitro.ts:156

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​

readonly name: 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​

ParameterType
otherHybridObject<{ 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:167

Start extracting a ZIP archive to the given destination directory. Returns an UnzipTask instance for progress tracking and cancellation.

Parameters​

ParameterTypeDescription
zipPathstringAbsolute path to the ZIP file (file:// URIs accepted)
destinationPathstringAbsolute path to extract into (created if missing)

Returns​

UnzipTask


extractWithPassword()​

extractWithPassword(zipPath, destinationPath, password): UnzipTask

Defined in: src/specs/Unzip.nitro.ts:176

Extract a password-protected ZIP archive.

Parameters​

ParameterTypeDescription
zipPathstringAbsolute path to the ZIP file
destinationPathstringAbsolute path to extract into
passwordstringPassword for the encrypted archive

Returns​

UnzipTask


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:188

Create a ZIP archive from a directory.

Parameters​

ParameterTypeDescription
sourcePathstringAbsolute path to the directory to compress
destinationZipPathstringAbsolute path for the output ZIP file

Returns​

ZipTask


zipWithPassword()​

zipWithPassword(sourcePath, destinationZipPath, password): ZipTask

Defined in: src/specs/Unzip.nitro.ts:200

Create a password-protected ZIP archive from a directory. Uses AES-256 encryption on both Android (via zip4j) and iOS (via SSZipArchive's AES variant). 0.3 used weak PKWARE-traditional encryption on iOS; 0.5.0 brings cross-platform AES-256 parity.

Parameters​

ParameterTypeDescription
sourcePathstringAbsolute path to the directory to compress
destinationZipPathstringAbsolute path for the output ZIP file
passwordstringPassword to protect the archive

Returns​

ZipTask