npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-zip-archive

v8.0.1

Published

A TurboModule wrapper on ZipArchive for React Native's New Architecture

Readme

React Native Zip Archive npm React Native New Architecture

Zip archive utility for React Native.

v8.0 requires React Native ≥ 0.70 with New Architecture enabled. For older RN versions, use v7.x:

npm install react-native-zip-archive@^7.0.0

iOS: Version 7.0.0+ requires a deployment target of iOS 15.5+ to comply with App Store privacy policy.

Requirements

| Platform | Minimum Version | |----------|-----------------| | React Native | >= 0.70.0 | | React | >= 18.0.0 | | iOS | >= 15.5 | | Android | >= API 23 (Android 6.0) |

Installation

npm install react-native-zip-archive

iOS:

cd ios && pod install

To enable New Architecture, see MIGRATION.md.

Usage

import {
  zip,
  zipWithPassword,
  unzip,
  unzipWithPassword,
  unzipAssets,
  subscribe,
  isPasswordProtected,
  getUncompressedSize,
  DEFAULT_COMPRESSION,
  NO_COMPRESSION,
  BEST_SPEED,
  BEST_COMPRESSION
} from 'react-native-zip-archive'

You may also want to use react-native-fs to access the file system:

import { DocumentDirectoryPath } from 'react-native-fs'

API

zip(source: string | string[], target: string, compressionLevel?: number): Promise<string>

Zip a folder (string) or an array of files to the target path.

  • To zip a single file, pass it as an array: zip([file], target).
  • compressionLevel is ignored on iOS when the source is a file array. Use a directory source for custom compression on iOS.

Compression Level Constants:

  • DEFAULT_COMPRESSION (-1)
  • NO_COMPRESSION (0)
  • BEST_SPEED (1)
  • BEST_COMPRESSION (9)
const sourcePath = DocumentDirectoryPath
const targetPath = `${DocumentDirectoryPath}/myFile.zip`

zip(sourcePath, targetPath)
  .then((path) => console.log(`zip completed at ${path}`))
  .catch((error) => console.error(error))

zipWithPassword(source: string | string[], target: string, password: string, encryptionType?: string, compressionLevel?: number): Promise<string>

Zip with password protection.

  • To zip a single file, pass it as an array: zipWithPassword([file], target, password).
  • compressionLevel is ignored on iOS when the source is a file array.

Encryption Types:

  • 'STANDARD' — Standard ZIP encryption (default)
  • 'AES-128' — AES 128-bit
  • 'AES-256' — AES 256-bit

iOS: Both AES-128 and AES-256 use AES-256 internally. AES encryption is not supported for file arrays on iOS — only STANDARD works.

const sourcePath = DocumentDirectoryPath
const targetPath = `${DocumentDirectoryPath}/myFile.zip`

zipWithPassword(sourcePath, targetPath, 'password', 'STANDARD')
  .then((path) => console.log(`zip completed at ${path}`))
  .catch((error) => console.error(error))

unzip(source: string, target: string, charset?: string): Promise<string>

Unzip from source to target.

The charset parameter is only supported on Android (default: UTF-8). On iOS it is ignored.

const sourcePath = `${DocumentDirectoryPath}/myFile.zip`
const targetPath = DocumentDirectoryPath

unzip(sourcePath, targetPath, 'UTF-8')
  .then((path) => console.log(`unzip completed at ${path}`))
  .catch((error) => console.error(error))

unzipWithPassword(source: string, target: string, password: string): Promise<string>

Unzip a password-protected archive.

unzipWithPassword(sourcePath, targetPath, 'password')
  .then((path) => console.log(`unzip completed at ${path}`))
  .catch((error) => console.error(error))

unzipAssets(assetPath: string, target: string): Promise<string>

Unzip a file from the Android assets folder. Android only.

assetPath is the relative path inside the pre-bundled assets folder (e.g. folder/myFile.zip). Do not pass an absolute path.

unzipAssets('./myFile.zip', DocumentDirectoryPath)
  .then((path) => console.log(`unzip completed at ${path}`))
  .catch((error) => console.error(error))

getUncompressedSize(source: string, charset?: string): Promise<number>

Returns the total uncompressed size of all files in the zip archive (in bytes).

The charset parameter is only supported on Android. On iOS it is ignored.

getUncompressedSize(sourcePath)
  .then((size) => console.log(`Uncompressed size: ${size} bytes`))
  .catch((error) => console.error(error))

subscribe(callback: ({ progress: number, filePath: string }) => void): EmitterSubscription

Subscribe to progress events. Useful for showing a progress bar.

  • progress — value from 0 to 1 (1 = completed)
  • filePath — the zip file path (empty on iOS for zip operations)

The event is global — check filePath in your callback to ensure it matches the operation you care about. Remember to call .remove() on the returned subscription when done.

import { useEffect } from 'react'

useEffect(() => {
  const sub = subscribe(({ progress, filePath }) => {
    console.log(`progress: ${progress}, file: ${filePath}`)
  })
  return () => sub.remove()
}, [])

Platform Support

| Feature | iOS | Android | Notes | |---------|-----|---------|-------| | zip (folder) | ✅ | ✅ | — | | zip (files array) | ✅ | ✅ | Compression level ignored on iOS | | zipWithPassword (folder) | ✅ | ✅ | AES encryption supported | | zipWithPassword (files array) | ⚠️ | ✅ | iOS: only STANDARD encryption | | unzip | ✅ | ✅ | Charset ignored on iOS | | unzipWithPassword | ✅ | ✅ | — | | unzipAssets | ❌ | ✅ | Android only | | isPasswordProtected | ✅ | ✅ | — | | getUncompressedSize | ✅ | ✅ | Charset ignored on iOS | | Progress Events | ✅ | ✅ | File path empty on iOS for zip |

Cross-Platform Notes

  • Compression levels: Android supports 0–9 for all operations. iOS supports them only for folder operations.
  • Encryption: Android supports AES-128, AES-256, and Standard ZIP encryption for all operations. iOS supports AES and Standard for folders, but only Standard for file arrays.
  • Charset: Android supports custom charsets (default UTF-8). iOS always uses UTF-8.
  • unzipAssets: Supports assets/ folder and content:// URIs on Android. Not supported on iOS.

Expo

This library requires an Expo Development Build and does not work in Expo Go because it includes custom native code. See the playground app for a working Expo Development Build example.

Playground

A fully-featured playground app is included to demonstrate every API method.

Migrating from v7

See MIGRATION.md for detailed migration instructions.

Testing

npm test

Contributing

See the playground app for testing and contribution reference.

Related Projects


"Buy Me A Coffee"