Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this 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.
Ce contenu n'est pas encore disponible dans votre langue.
Install
Section titled “Install”bun add @capgo/capacitor-downloaderbunx cap syncImport
Section titled “Import”import { CapacitorDownloader } from '@capgo/capacitor-downloader';API Overview
Section titled “API Overview”download
Section titled “download”Start a new download task.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await Downloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Pause an active download. Download can be resumed later from the same position.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });resume
Section titled “resume”Resume a paused download. Continues from where it was paused.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });Stop and cancel a download permanently. Downloaded data will be deleted.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
Section titled “checkStatus”Check the current status of a download.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
Section titled “getFileInfo”Get information about a downloaded file.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });Type Reference
Section titled “Type Reference”DownloadOptions
Section titled “DownloadOptions”Configuration options for starting a 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
Section titled “DownloadTask”Represents the current state and progress of a download task.
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 Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.