Mulai
Salin prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
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.
Instal
Judul bagian “Instal”bun add @capgo/capacitor-downloaderbunx cap syncImpor
Judul Bagian “Impor”import { CapacitorDownloader } from '@capgo/capacitor-downloader';API Ringkasan
Judul Bagian “API Ringkasan”download
Bagian Judul “download”Mulai tugas download baru.
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
Bagian Judul “pause”Tangguhkan download aktif. Download dapat dilanjutkan kemudian dari posisi yang sama.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });resume
Bagian Judul “resume”Mengaktifkan kembali download yang terhenti.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });Bagian berjudul “hentikan”
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
Salin ke clipboardBagian berjudul “cekStatus”
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
Salin ke clipboardBagian berjudul “getFileInfo”
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });Salin ke clipboard
Referensi TipeDownloadOptions
Pilihan DownloadOpsi pengaturan untuk memulai 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
Tugas DownloadMenggambarkan keadaan saat ini dan kemajuan tugas 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';}Sumber Kebenaran
Halaman ini dihasilkan dari plugin’sRe-run sinkronisasi ketika publik __CAPGO_KEEP_0__ berubah di atas. src/definitions.ts. Re-run the sync when the public API changes upstream.