Démarrage
Copiez un prompt de configuration avec les étapes d'installation et le guide Markdown complet pour ce plugin.
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.
Installer
Section intitulée « Installer »bun add @capgo/capacitor-downloaderbunx cap syncImporter
Section intitulée « Importer »import { CapacitorDownloader } from '@capgo/capacitor-downloader';API Aperçu
Section intitulée “API Aperçu”Démarrer une nouvelle tâche de téléchargement.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await Downloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Mettre en pause un téléchargement actif. Le téléchargement peut être repris plus tard à la même position.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });Reprendre un téléchargement mis en pause. Continuer depuis l'endroit où il était mis en pause.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });Arrêtez et annulez une téléchargement de manière permanente. Les données téléchargées seront supprimées.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
Section intitulée “checkStatus”Vérifiez l'état actuel d'un téléchargement.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
Section intitulée “getFileInfo”Obtenez des informations sur un fichier téléchargé.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });Référence de type
Section intitulée “Type Reference”DownloadOptions
Section intitulée “DownloadOptions”Options de configuration pour démarrer un téléchargement.
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
Section intitulée “Téléchargement de tâche”Représente l'état actuel et le progrès d'une tâche de téléchargement.
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';}Source de Vérité
Section intitulée “Source de Vérité”Cette page est générée à partir du plugin’s src/definitions.ts. Re-run la synchronisation lorsque les public API changent en amont.
Continuez de la section « Début de l'expérience »
Section intitulée “Continuez de la section « Début de l'expérience »Si vous utilisez Début de l'expérience planer le tableau de bord et les opérations API, connectez-le à En utilisant @capgo/capacitor-downloader pour la capacité native dans En utilisant @capgo/capacitor-downloader, API Vue d'ensemble pour le détail d'implémentation dans API Vue d'ensemble, Introduction pour le détail d'implémentation dans Introduction, API Clés pour le détail d'implémentation dans API Clés, et Appareils pour le détail d'implémentation dans Appareils.