시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
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-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 AI 도구에 Capgo 스킬을 추가하세요:
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.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-downloaderbunx cap sync가져오기
“Import” 섹션import { CapacitorDownloader } from '@capgo/capacitor-downloader';빠른 시작
“빠른 시작” 섹션알려진 폴더로 다운로드하고, 진행 상황을 추적하며, 지원되는 경우 앱 재시작 후 이어서 다운로드합니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const progressListener = await CapacitorDownloader.addListener('downloadProgress', (event) => { if (event.id === 'offline-pack') { console.log(event.progress); }});
const task = await CapacitorDownloader.download({ id: 'offline-pack', url: 'https://cdn.example.com/large-pack.zip', destination: 'downloads/offline-pack.zip',});예시: 일시 중지 및 재개
섹션 제목: “예시: 일시중지 및 재개”await CapacitorDownloader.pause({ id: 'offline-pack' });await CapacitorDownloader.resume({ id: 'offline-pack' });예시: 완료된 파일 확인
섹션 제목: “예시: 완료된 파일 검사”import { Capacitor } from '@capacitor/core';import { Directory, Filesystem } from '@capacitor/filesystem';
const relativePath = 'downloads/offline-pack.zip';const path = Capacitor.getPlatform() === 'ios' ? (await Filesystem.getUri({ directory: Directory.Documents, path: relativePath })).uri : relativePath;
const info = await CapacitorDownloader.getFileInfo({ path });자주 하는 실수
“흔한 실수” 섹션- 저장 위치: 선택
destination각 플랫폼에서 앱이 읽을 수 있는 - 백그라운드: iOS와 Android에서는 백그라운드에서 다운로드가 실행됩니다. Web에서는
download()구현되어 있지 않으며, 대신 브라우저 다운로드 플로우를 사용하세요. - 상태: 사용
checkStatus앱 프로세스가 살아 있는 동안에만 유효합니다. iOS에서는 앱을 다시 실행해도 task ID가 복원되지 않습니다.
API 개요
“API 개요” 섹션download
“download” 섹션새 다운로드 작업을 시작합니다.
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
“pause” 섹션진행 중인 다운로드를 일시 중지합니다. 나중에 같은 지점에서 다운로드를 재개할 수 있습니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({ id: 'id-123' });resume
“resume” 섹션일시 중지된 다운로드를 재개합니다. 중단된 시점부터 다시 시작합니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({ id: 'id-123' });stop
“stop” 섹션다운로드를 중지하고 영구적으로 취소합니다. 다운로드된 데이터는 삭제됩니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({ id: 'id-123' });checkStatus
“checkStatus” 섹션다운로드의 현재 상태를 확인합니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.checkStatus({ id: 'id-123' });console.log(result);getFileInfo
“getFileInfo” 섹션다운로드된 파일에 대한 정보를 가져옵니다.
import { CapacitorDownloader } from '@capgo/capacitor-downloader';
const result = await CapacitorDownloader.getFileInfo({ path: 'path/to/file' });console.log(result);타입 레퍼런스
“타입 참조” 섹션DownloadOptions
“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
“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';}Source of Truth
“Source Of Truth” 섹션이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.
시작하기 다음 단계
“Getting Started에서 계속하기” 섹션사용 중이라면 시작하기 대시보드 및 API 운영을 계획하려면, 이를 다음과 연결하세요 @capgo/capacitor-downloader 사용하기 @capgo/capacitor-downloader 사용 시 네이티브 기능을 위해서는, API 개요 구현 세부 사항은 API 개요에서 소개 구현 세부 사항은 소개에서 API 키 API Keys의 구현 세부 사항은, 기기 Devices의 구현 세부 사항은.