컨텐츠로 바로가기

시작하기

GitHub

Capgo의 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-file-picker` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요.

터미널 창
bun add @capgo/capacitor-file-picker
bunx cap sync
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';

장치에서 하나 이상의 파일을 선택합니다.

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickFiles({
types: ['application/pdf', 'image/*'],
limit: 5,
readData: false
});
console.log('Picked files:', result.files);

갤러리에서 하나 이상의 이미지를 선택합니다.(안드로이드/아이폰 전용)

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickImages({
limit: 10,
readData: false
});
console.log('Picked images:', result.files);

__CAPGO_KEEP_1__

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickVideos({
limit: 3,
skipTranscoding: true
});
console.log('Picked videos:', result.files);

__CAPGO_KEEP_3__

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickMedia({
limit: 5,
readData: true
});
console.log('Picked media:', result.files);

pickDirectory

__CAPGO_KEEP_0__

__CAPGO_KEEP_5__

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickDirectory();
console.log('Selected directory:', result.path);

convertHeicToJpeg

__CAPGO_KEEP_0__

__CAPGO_KEEP_7__

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.convertHeicToJpeg({
path: '/path/to/image.heic',
quality: 0.9
});
console.log('Converted file:', result.path);

파일을 새로운 위치로 복사합니다.

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
await CapgoFilePicker.copyFile({
from: '/source/file.pdf',
to: '/destination/file.pdf',
overwrite: true
});

checkPermissions

__CAPGO_KEEP_0__

파일을 읽는 데 필요한 권한을 확인합니다. 안드로이드 전용.

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const status = await CapgoFilePicker.checkPermissions();
console.log('Read permission:', status.readExternalStorage);

requestPermissions

__CAPGO_KEEP_0__

파일을 읽는 데 필요한 권한을 요청합니다. 안드로이드 전용.

import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const status = await CapgoFilePicker.requestPermissions();
if (status.readExternalStorage === 'granted') {
console.log('Permission granted');
}

타입 참조

__CAPGO_KEEP_0__

PickFilesOptions

__CAPGO_KEEP_0__

파일을 선택하는 옵션.

export interface PickFilesOptions {
/**
* List of accepted MIME types or file extensions.
* On iOS, only MIME types are supported.
* Examples: ['image/*'], ['application/pdf'], ['.pdf', '.doc']
*/
types?: string[];
/**
* Maximum number of files to pick.
* Set to 0 for unlimited (platform default).
* @default 0
*/
limit?: number;
/**
* Whether to read the file data as base64.
* Note: Reading large files may cause memory issues.
* @default false
*/
readData?: boolean;
}

파일을 선택한 결과.

export interface PickFilesResult {
/** Array of picked files */
files: PickedFile[];
}

클립보드에 복사

export interface PickMediaOptions {
/**
* Maximum number of files to pick.
* Set to 0 for unlimited (platform default).
* @default 0
*/
limit?: number;
/**
* Whether to read the file data as base64.
* Note: Reading large files may cause memory issues.
* @default false
*/
readData?: boolean;
/**
* iOS only: Skip transcoding of videos.
* @default false
*/
skipTranscoding?: boolean;
/**
* iOS 15+ only: Show ordered selection badges.
* @default false
*/
ordered?: boolean;
}

PickDirectoryResult

폴더를 선택한 결과.

클립보드에 복사

export interface PickDirectoryResult {
/** The path to the selected directory */
path: string;
}

ConvertHeicToJpegOptions

클립보드에 복사

HEIC를 JPEG로 변환하는 옵션입니다.

export interface ConvertHeicToJpegOptions {
/** The path to the HEIC file to convert */
path: string;
/**
* The compression quality for JPEG (0.0 - 1.0).
* @default 0.9
*/
quality?: number;
}

ConvertHeicToJpegResult

ConvertHeicToJpegResult 섹션

HEIC를 JPEG로 변환한 결과입니다.

export interface ConvertHeicToJpegResult {
/** The path to the converted JPEG file */
path: string;
}

CopyFileOptions

CopyFileOptions 섹션

파일을 복사하는 옵션입니다.

export interface CopyFileOptions {
/** Source file path */
from: string;
/** Destination file path */
to: string;
/**
* Whether to overwrite if destination exists.
* @default false
*/
overwrite?: boolean;
}

PermissionStatus

PermissionStatus 섹션

파일 접근 권한 상태입니다.

export interface PermissionStatus {
/** Whether permission to read media files is granted */
readExternalStorage: PermissionState;
/** Whether permission to access media location is granted */
accessMediaLocation?: PermissionState;
}

PickerDismissedListener

PickerDismissedListener 섹션

Listener callback for picker dismissed event.

export type PickerDismissedListener = (event: null) => void;

선택된 파일을 나타냅니다.

export interface PickedFile {
/** The name of the file */
name: string;
/** The path to the file */
path?: string;
/** The MIME type of the file */
mimeType: string;
/** The size of the file in bytes */
size: number;
/**
* The base64 encoded data of the file.
* Only present if readData was true.
*/
data?: string;
/**
* The Blob instance of the file.
* Web only.
*/
blob?: Blob;
/** Width in pixels (images/videos only) */
width?: number;
/** Height in pixels (images/videos only) */
height?: number;
/** Duration in seconds (videos only) */
duration?: number;
/** Last modified timestamp in milliseconds */
modifiedAt?: number;
}

PermissionState

권한 상태

권한 상태의 값.

export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';

실질적인 원천

실질적인 원천

이 페이지는 플러그인의 src/definitions.ts. Re-run the sync when the public API changes upstream.

Getting Started에서 계속 진행하세요

Getting Started에서 계속 진행하는 섹션입니다

__CAPGO_KEEP_0__을 사용 중이라면 Getting Started __CAPGO_KEEP_0__을 __CAPGO_KEEP_1__-file-picker와 연결하여 capgo/capacitor-file-picker를 사용하는 native capability에 대해 capgo/capacitor-data-storage-sqlite를 사용하여 capgo/capacitor-data-storage-sqlite의 implementation detail에 대해 capgo/capacitor-data-storage-sqlite를 사용하여 capgo/capacitor-data-storage-sqlite의 native capability에 대해 for the native capability in Using @capgo/capacitor-data-storage-sqlite, @capgo/capacitor-file capgo/capacitor-파일의 구현 세부 정보에 대해 capgo/capacitor-파일을 사용하여 capgo/capacitor-파일을 사용하여 native 기능을 구현하는 방법에 대해