Skip to main content

cordova-plugin-zip Alternative for Capacitor

cordova-plugin-zip alternative for Capacitor: zip and unzip on device with @capgo/capacitor-zip, progress events, and Android AES passwords.

Illustration of migrating a Cordova app to Capacitor, used for a zip and unzip plugin guide

The practical cordova-plugin-zip alternative for a Capacitor app is @capgo/capacitor-zip. It keeps native unzip off the JavaScript bridge, adds zip() for folders and files, surfaces progress like Cordova’s optional callback, and normalizes file:// paths from older Cordova file plugins. This guide lists npm facts, install steps, usage for update bundles, and a Cordova to Capacitor API map.

Why leave cordova-plugin-zip in Capacitor

cordova-plugin-zip on npm is version 3.1.0. The last numbered release on the npm time object is 23 February 2016. The registry modified timestamp is 14 June 2022 (metadata only, not a new plugin version). The npm package page is cordova-plugin-zip (the registry lists a GitHub URL that no longer resolves).

The published zip.js module exposes only:

  • zip.unzip(source, destination, callback, progressCallback?) with success code 0 or failure -1
  • progressCallback receives { loaded, total } byte counts for the archive

There is no zip() in the Cordova JavaScript API. The plugin depends on cordova-plugin-file path strings and legacy cordova.exec wiring.

@capgo/capacitor-zip latest on npm is 8.2.5 with a modified date of 12 November 2026. src/definitions.ts documents zip, unzip, addListener('progress'), optional password on Android, and includeParentFolder. Per-operation onProgress in unzip options is marked 8.3.0 and later. Capgo ships fixes on an open source cadence where a human still reviews, tests and merges 50+ pull requests daily.

Install

The command below installs the npm 8.x line for Capacitor 8 (@capacitor/core >= 8). Capgo plugin majors track Capacitor majors. On Capacitor 7, install the matching 7.x release instead (see the plugin README).

bun add @capgo/capacitor-zip
bunx cap sync

Use absolute or file:// paths the native layer can read. After you unpack a live update archive, run through the checks in checklist for validating Capacitor app updates.

Usage example

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

export async function unpackUpdateBundle(zipPath: string, targetDir: string) {
  const handle = await CapacitorZip.addListener('progress', (event) => {
    if (event.lengthComputable) {
      console.log('unzip', Math.round(event.progress * 100), event.currentFile);
    }
  });
  try {
    await CapacitorZip.unzip({
      source: zipPath,
      destination: targetDir,
    });
  } finally {
    await handle.remove();
  }
}

export async function backupFolder(folderPath: string, archivePath: string) {
  await CapacitorZip.zip({
    source: folderPath,
    destination: archivePath,
    includeParentFolder: false,
  });
}

zip() throws on web; run compression on iOS, Android, or your server.

Migrating from Cordova to Capacitor

// Before (Cordova)
zip.unzip(
  sourceZip,
  outputDirectory,
  (code) => code === 0 && console.log('done'),
  (progress) => console.log(progress.loaded, progress.total),
);
// After (Capacitor)
import { CapacitorZip } from '@capgo/capacitor-zip';

const handle = await CapacitorZip.addListener('progress', (event) => {
  console.log(event.loaded, event.total);
});
try {
  await CapacitorZip.unzip({
    source: sourceZip,
    destination: outputDirectory,
  });
} finally {
  await handle.remove();
}

API mapping table

cordova-plugin-zip (zip global) @capgo/capacitor-zip
unzip(src, dest, callback, progress?) unzip({ source, destination, password? }) rejects on failure instead of code -1
Progress { loaded, total } ZipProgressEvent via addListener('progress'); optional onProgress from plugin 8.3.0
Success callback with 0 Promise resolves when extraction completes
Failure callback with -1 Promise rejects with error message
Not in Cordova JS API zip({ source, destination, password?, includeParentFolder? })
Not in Cordova getPluginVersion()
Depends on cordova-plugin-file URLs Accepts file:// and percent-encoded paths, normalized before native I/O
Cordova plugin install bun add @capgo/capacitor-zip plus bunx cap sync

Zip handling runs in native code. Use Capgo Build when you add the plugin to production binaries, then adjust unpack paths in Capgo live updates with the validation checklist above. For the full platform move, read the Cordova to Capacitor migration guide.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.