Getting Started
Copiez un prompt de configuration avec les étapes d'installation et la guide markdown complète 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.
Installation
Section intitulée « Installation »Vous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA à l'aide de la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-downloader` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à la plateforme ci-dessous :
bun add @capgo/capacitor-downloaderbunx cap syncImporter
Section intitulée « Importer »import { CapacitorDownloader } from '@capgo/capacitor-downloader';API Vue d'ensemble
Section intitulée « API Vue d'ensemble »Lancer une nouvelle tâche de téléchargement.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await CapacitorDownloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Arrêtez un téléchargement en cours. Le téléchargement peut être repris ultérieurement à la même position.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({ id: 'id-123' });Reprendre un téléchargement arrêté. Continuer depuis l'endroit où il était arrêté.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({ id: 'id-123' });Stopper et annuler un téléchargement définitivement. Les données téléchargées seront supprimées.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({ id: 'id-123' });checkStatus
Section intitulée « vérifier l'état »Vérifiez l'état actuel d'un téléchargement.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.checkStatus({ id: 'id-123' });console.log(result);getFileInfo
Section intitulée « getFileInfo »Obtenir des informations sur un fichier téléchargé.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.getFileInfo({ path: 'path/to/file' });console.log(result);Référence de type
Section intitulée « Référence de type »DownloadOptions
Section intitulée « Options de téléchargement »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âche de téléchargement »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é
Titre de la section « Source De Vérité »Cette page est générée à partir du plugin’s src/definitions.tsRe-run the synchronisation lorsque le public API change en amont.
Continuez de la section « Getting Started »
Titre de la section « Continuez de la section Getting Started »Si vous utilisez Getting Started pour planifier le tableau de bord et les opérations API, connectez-l’avec Utilisez @capgo/capacitor-downloader pour la capacité native dans Utilisez @capgo/capacitor-downloader, API Vue d'ensemble pour le détail d'implémentation dans API Vue d'ensemble, Introduction pour les détails d'implémentation dans l'Introduction. Clés API pour les détails d'implémentation dans les API clés, et Appareils pour les détails d'implémentation sur les appareils.