Mulai Menggunakan
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.
Install
Bab berjudul “Install”Kamu bisa menggunakan Pengaturan Bantu AI untuk menginstal plugin. Tambahkan Capgo kemampuan ke alat AI kamu menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-downloader` plugin in my project.Jika Anda lebih suka Setup Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah ini:
bun add @capgo/capacitor-downloaderbunx cap syncImport
Bab berjudul “Import”import { CapacitorDownloader } from '@capgo/capacitor-downloader';Ringkasan API
Bab berjudul “Ringkasan API”download
Bab berjudul “download”Mulai tugas download baru.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await CapacitorDownloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});Menghentikan download aktif. Download dapat dilanjutkan dari posisi yang sama kemudian.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({ id: 'id-123' });resume
Bagian berjudul “resume”Mengaktifkan kembali download yang dihentikan. Melanjutkan dari posisi yang dihentikan.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({ id: 'id-123' });Menghentikan dan membatalkan download secara permanen. Data yang telah diunduh akan dihapus.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({ id: 'id-123' });checkStatus
Bagian berjudul “checkStatus”Periksa status download saat ini.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.checkStatus({ id: 'id-123' });console.log(result);getFileInfo
Bagian berjudul “getFileInfo”Memperoleh informasi tentang file yang telah diunduh.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.getFileInfo({ path: 'path/to/file' });console.log(result);Referensi Tipe
Bagian berjudul “Referensi Tipe”DownloadOptions
Bagian berjudul “DownloadOptions”Pilihan 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
Bagian berjudul “DownloadTask”Mewakili keadaan dan kemajuan tugas download saat ini.
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
Judul Bagian: “Sumber Kebenaran”Halaman ini dibuat dari plugin’s src/definitions.tsRe-run sinkronisasi ketika publik API berubah di atas
Teruskan dari Getting Started
Judul Bagian: “Teruskan dari Getting Started”Jika Anda menggunakan Mulai Menggunakan untuk merencanakan dashboard dan API operasi, hubungkannya dengan Menggunakan @capgo/capacitor-downloader untuk kemampuan asli di Menggunakan @capgo/capacitor-downloader, API Ringkasan untuk detail implementasi di API Ringkasan, Introduction untuk detail implementasi di Introduction, Kunci API untuk detail implementasi di Kunci API dan Peralatan Untuk detail implementasi di Perangkat.