はじめに
このプラグインのインストール手順とフル マークダウン ガイドを含むセットアップ コマンドをコピーします。
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.
インストール
「インストール」のセクションbun add @capgo/capacitor-downloaderbunx cap syncインポート
「インポート」のセクションimport { CapacitorDownloader } from '@capgo/capacitor-downloader';API の概要
「API の概要」のセクション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'});pause
「一時停止」のセクションダウンロードを一時停止 ダウンロードは後で同じ位置から再開できます
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });resume
再開ダウンロードを再開します。 再開した位置から続きます。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });stop
終了ダウンロードを終了し、削除します。 ダウンロードしたデータは削除されます。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });checkStatus
ステータス確認クリップボードにコピー
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });getFileInfo
クリップボードにコピーダウンロードファイルの情報を取得します。
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });タイプ リファレンス
タイプ リファレンス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. Re-run the sync when the public API changes upstream.