Richtlinie
Tutorial zu Zip
Mit @capgo/capacitor-zip verwenden
Capacitor Zip-Plugin zum Komprimieren und Extrahieren von Zip-Archiven.
Installieren
bun add @capgo/capacitor-zip
bunx cap sync
Was dieses Plugin enthüllt
zip- Ein Datei oder Verzeichnis komprimieren, um ein ZIP-Archiv zu erstellen.unzip- Ein ZIP-Archiv in ein bestimmtes Zielverzeichnis extrahieren.
Beispiel für die Verwendung
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
Ein ZIP-Archiv in ein bestimmtes Zielverzeichnis entpacken.
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
- GitHub https://github.com/Cap-go/capacitor-zip/
- Dokumentation: /docs/plugins/zip/