컨텐츠로 바로가기

시작하기

복사하기
bun add @capgo/capacitor-downloader
bunx 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'
});

다운로드 중단: 다운로드는 중단된 위치에서 다시 시작할 수 있습니다.

import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.pause({} as { id: string });

__CAPGO_KEEP_0__. __CAPGO_KEEP_1__에서부터 다시 시작합니다.

import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.resume({} as { id: string });

__CAPGO_KEEP_0__. 다운로드한 데이터가 삭제됩니다.

import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.stop({} as { id: string });

checkStatus

__CAPGO_KEEP_3__

__CAPGO_KEEP_2__

import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.checkStatus({} as { id: string });

getFileInfo

__CAPGO_KEEP_4__

__CAPGO_KEEP_5__

import { CapacitorDownloader } from '@capgo/capacitor-downloader';
await CapacitorDownloader.getFileInfo({} as { path: string });

__CAPGO_KEEP_6__

타입 참조 섹션

다운로드를 시작하는 데 필요한 구성 옵션입니다.

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';
}

다운로드 작업의 현재 상태와 진행 상황을 나타냅니다.

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';
}

진실의 근원

진실의 근원 섹션

이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.