Skip to main content

Password Protection

Work with password-protected ZIP archives using AES-256 encryption.

Extract a Protected Archive

import { getUnzip } from 'react-native-nitro-unzip';

const unzip = getUnzip();
const task = unzip.extractWithPassword(
'/path/to/encrypted.zip',
'/path/to/output',
'mypassword'
);

task.onProgress((p) => {
console.log(`${(p.progress * 100).toFixed(0)}%`);
});

const result = await task.await();

extractWithPassword works identically to extract but takes a third password parameter. Progress tracking and cancellation work the same way.

Create a Protected Archive

const task = unzip.zipWithPassword(
'/path/to/folder',
'/output/secure.zip',
'mypassword'
);

const result = await task.await();

Encryption Details

PlatformEncryption
AndroidAES-256 via zip4j
iOSStandard ZIP encryption via SSZipArchive
Cross-platform compatibility

Archives created with zipWithPassword on one platform can be extracted with extractWithPassword on the other.