Anfangen
Eine Einrichtungsvorschlagszeile mit den Installationsanweisungen und der vollständigen Markdown-Dokumentation für dieses Plugin kopieren.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-downloader`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/downloader/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
InstallSie können unsere AI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie den Capgo-Fähigkeiten Ihre AI-Tool mithilfe der folgenden Befehl hinzu:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsDann verwenden Sie die folgende Anfrage:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-downloader` plugin in my project.Wenn Sie die manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und folgen Sie den unten angegebenen Plattform-spezifischen Anweisungen:
bun add @capgo/capacitor-downloaderbunx cap syncImportieren
Importierenimport { CapacitorDownloader } from '@capgo/capacitor-downloader';API Übersicht
Abschnitt mit dem Titel “API Übersicht”Einen neuen Download-Auftrag starten.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await Downloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Ein aktives Download pausieren. Der Download kann später von der gleichen Position fortgesetzt werden.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });Ein pausierter Download fortsetzen. Fortsetzt von der Position, an der er pausiert wurde.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });Stoppen und einen Download dauerhaft abbrechen. Heruntergeladene Daten werden gelöscht.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
Abschnitt mit dem Titel “checkStatus”Überprüfen Sie den aktuellen Status eines Downloads.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
Abschnitt mit dem Titel “getFileInfo”Informationen über ein heruntergeladenenes Datei erhalten.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });Typenverweis
Abschnitt mit dem Titel “DownloadOptions”DownloadOptions
TypenverweisKonfigurationsoptionen für das Starten eines Downloads.
export interface DownloadOptions { /** Unique identifier for this download task */ id: string; /** URL of the file to download */ url: string; /** Local file path where the download will be saved */ destination: string; /** Optional HTTP headers to include in the request */ headers?: { [key: string]: string }; /** Network type requirement for download */ network?: 'cellular' | 'wifi-only'; /** Download priority level */ priority?: 'high' | 'normal' | 'low';}DownloadTask
Abschnitt mit dem Titel “DownloadTask”Stellt den aktuellen Status und den Fortschritt eines Downloadauftrags dar.
export interface DownloadTask { /** Unique identifier for the download task */ id: string; /** Download progress from 0 to 100 */ progress: number; /** Current state of the download */ state: 'PENDING' | 'RUNNING' | 'PAUSED' | 'DONE' | 'ERROR';}Quelle der Wahrheit
Abschnitt mit dem Titel “Quelle der Wahrheit”Diese Seite wird aus dem Plugin generiert. src/definitions.ts. Wenn sich die öffentliche API API im Hintergrund ändert, starte den Sync erneut.
Weitermachen von Getting Started
Abschnitt mit dem Titel “Weitermachen von Getting Started”Wenn Sie das Produkt verwenden Einstieg um das Dashboard und API-Operationen zu planen, verbinden Sie es mit Mit @capgo/capacitor-Downloader für die native Fähigkeit in Mit @capgo/capacitor-Downloader, API-Übersicht für die Implementierungsdetails in API-Übersicht, Einführung für die Implementierungsdetails in Einführung, API-Schlüssel für die Implementierungsdetails in API-Schlüssel und Geräte für die Implementierungsdetails in Geräte.