Inizia
Copia una riga di installazione con i passaggi e la guida markdown completa per questo 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.
Installa
Sezione intitolata “Installa”bun add @capgo/capacitor-downloaderbunx cap syncImporta
Sezione intitolata “Importa”import { CapacitorDownloader } from '@capgo/capacitor-downloader';API Panoramica
Sezione intitolata “API Panoramica”download
Sezione intitolata “download”Avvia una nuova attività di download.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await Downloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Sospendi un download attivo. Il download può essere ripreso in seguito dalla stessa posizione.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });Riassumere un download sospeso. Continua da dove era stato sospeso.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });Ferma e cancella un download permanentemente. I dati scaricati verranno eliminati.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
Sezione intitolata “verificaStato”Verifica lo stato corrente di un download.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
Sezione intitolata “getFileInfo”Ottieni informazioni sul file scaricato.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });Riferimento ai Tipi
Sezione intitolata “Riferimento ai Tipi”DownloadOptions
Sezione intitolata “DownloadOptions”Opzioni di configurazione per l'avvio di un download.
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
Sezione intitolata “DownloadTask”Rappresenta lo stato attuale e il progresso di una task di download.
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';}Fonte di Verità
Sezione intitolata “Fonte di Verità”Questa pagina è generata dal plugin e può essere aggiornata quando le informazioni pubbliche __CAPGO_KEEP_0__ vengono aggiornate su Cloudflare. src/definitions.tsRiepiloga quando le informazioni pubbliche API vengono aggiornate su Cloudflare.