Skip to main content
@capgo/capacitor-zip Files & Storage Open source

Zip Capacitor plugin

A free Capacitor plugin for zipping and unzipping files on iOS, Android, and Web.

Install

bun add @capgo/capacitor-zip bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-zip
  • pnpm add @capgo/capacitor-zip
  • yarn add @capgo/capacitor-zip

Guide

How to use Zip in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

Zip plugin preview QR code

Using @capgo/capacitor-zip

Capacitor Zip Plugin for compressing and extracting zip archives.

Install

bun add @capgo/capacitor-zip
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { CapacitorZip } from '@capgo/capacitor-zip';

API at a glance

Method Description
zip Compress a file or directory to create a ZIP archive.
unzip Extract a ZIP archive to a specified destination directory.

Examples

zip()

Compress a file or directory to create a ZIP archive.

import { CapacitorZip } from '@capgo/capacitor-zip';

// Compress a directory without password
await CapacitorZip.zip({
  source: '/path/to/my-folder',
  destination: '/path/to/output.zip'
});

unzip()

Extract a ZIP archive to a specified destination directory.

import { CapacitorZip } from '@capgo/capacitor-zip';

// Extract a standard ZIP archive
await CapacitorZip.unzip({
  source: '/path/to/archive.zip',
  destination: '/path/to/extract-folder'
});

Full reference

Keep going from Using @capgo/capacitor-zip

If you are using Using @capgo/capacitor-zip to plan native plugin work, connect it with @capgo/capacitor-zip for the implementation detail in @capgo/capacitor-zip, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Zip plugin FAQ

How do I install the Zip plugin in a Capacitor app?

Run "bun add @capgo/capacitor-zip" (or "npm install @capgo/capacitor-zip"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-zip" in your app code.

Does @capgo/capacitor-zip work with React, Vue and Angular?

Yes. Zip is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-zip support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-zip free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-zip/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Zip without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Zip changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo