开始
复制一个包含安装步骤和此插件的完整Markdown指南的配置提示。
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.
您可以使用我们的 AI 助手设置来安装插件。使用以下命令将 Capgo 技能添加到您的 AI 工具中:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-downloader` plugin in my project.如果您prefer手动设置,安装插件并运行以下命令,然后遵循以下平台特定的说明:
bun add @capgo/capacitor-downloaderbunx cap syncimport { CapacitorDownloader } from '@capgo/capacitor-downloader';API 简介
API 简介download
Section titled “下载”开始一个新的下载任务。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const task = await CapacitorDownloader.download({ id: 'my-download', url: 'https://example.com/file.pdf', destination: 'downloads/file.pdf'});pause
Section titled “暂停”暂停一个正在下载的任务。 下载可以在同一位置从暂停处恢复。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({ id: 'id-123' });resume
Section titled “恢复”恢复一个暂停的下载。 从暂停处继续下载。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({ id: 'id-123' });stop
标题:“停止”永久停止和取消下载。 下载的数据将被删除。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({ id: 'id-123' });checkStatus
标题:“检查状态”检查下载的当前状态。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.checkStatus({ id: 'id-123' });console.log(result);getFileInfo
标题:“获取文件信息”获取下载的文件信息。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.getFileInfo({ path: 'path/to/file' });console.log(result);类型参考
标题:“类型参考”DownloadOptions
下载选项下载启动配置选项
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
下载任务下载任务的当前状态和进度
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';}真实来源
本页由插件生成重新同步公共资源__CAPGO_KEEP_0__时 src/definitions.ts当公共API上游发生变化时,请重新运行同步。
继续从开始
继续从开始如果您正在使用 入门指南 来规划仪表板和API操作,连接它与 使用@capgo/capacitor-下载器 为native能力在使用@capgo/capacitor-下载器 API概述 为实现细节在API概述 介绍 为实现细节在介绍 API密钥 为实现细节在API密钥, 设备 __CAPGO_KEEP_0__