Anleitung
Wie man Zip in Capacitor verwendet
Verwendung von @capgo/capacitor-zip
Capacitor Zip-Plugin für die Komprimierung und Extraktion von Zip-Archiven.
Installieren
bun add @capgo/capacitor-zip
bunx cap sync
bunx cap sync kopiert das Plugin-code in Ihre native Projekte. Führen Sie es erneut durch, nachdem jede Plugin-Upgrade durchgeführt wurde.
Importieren
import { CapacitorZip } from '@capgo/capacitor-zip';
API im Überblick
| Methode | Beschreibung |
|---|---|
zip |
Eine Datei oder ein Verzeichnis komprimieren, um ein ZIP-Archiv zu erstellen. |
unzip |
Entpacken Sie ein ZIP-Archiv in ein bestimmtes Zielverzeichnis. |
Beispiele
zip()
Eine Datei oder ein Verzeichnis komprimieren, um ein ZIP-Archiv zu erstellen.
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()
Entpacken Sie ein ZIP-Archiv in ein bestimmtes Zielverzeichnis.
import { CapacitorZip } from '@capgo/capacitor-zip';
// Extract a standard ZIP archive
await CapacitorZip.unzip({
source: '/path/to/archive.zip',
destination: '/path/to/extract-folder'
});
Vollständige Referenz
Fortfahren von Using @capgo/capacitor-zip
Wenn Sie @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-zip verwenden Mit @capgo/capacitor-zip um native Plugin-Arbeit zu planen, verbinden Sie es mit @capgo/capacitor-zip für die Implementierungsdetails in @capgo/capacitor-zip Getting Started für die Implementierungsdetails in Einstieg Capgo Plugin-Verzeichnis für den Produktworkflow in Capgo Plugin-Verzeichnis Capacitor Plugins von Capgo für die Implementierungsdetails in Capacitor Plugins von Capgo, und Plugins hinzufügen oder aktualisieren für die Implementierungsdetails in Plugins hinzufügen oder aktualisieren.