__CAPGO_KEEP_0__
__CAPGO_KEEP_4__
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-file-picker`
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/file-picker/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.
__CAPGO_KEEP_11__
설치 제목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-pickerbunx cap syncImport
Import 제목import { CapgoFilePicker } from '@capgo/capacitor-file-picker';API 개요
API 개요 제목pickFiles
__CAPGO_KEEP_0__ 파일 선택장치에서 하나 이상의 파일을 선택하세요.
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);pickImages
__CAPGO_KEEP_0__ 이미지 선택갤러리에서 하나 이상의 이미지를 선택하세요. Android/iOS만 지원합니다.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickImages({ limit: 10, readData: false});console.log('Picked images:', result.files);pickVideos
__CAPGO_KEEP_0__ 비디오 선택갤러리에서 하나 이상의 비디오를 선택하세요. Android/iOS만 지원합니다.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickVideos({ limit: 3, skipTranscoding: true});console.log('Picked videos:', result.files);pickMedia
__CAPGO_KEEP_0__ 미디어 선택갤러리에서 하나 이상의 이미지를 또는 동영상을 선택하세요. Android/iOS 전용.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickMedia({ limit: 5, readData: true});console.log('Picked media:', result.files);pickDirectory
섹션 제목 “pickDirectory”장치에서 폴더를 선택하세요. Android/iOS 전용.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const result = await CapgoFilePicker.pickDirectory();console.log('Selected directory:', result.path);convertHeicToJpeg
섹션 제목 “convertHeicToJpeg”HEIC 이미지 형식을 JPEG 형식으로 변환하세요. iOS 전용.
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);copyFile
섹션 제목 “copyFile”파일을 새로운 위치로 복사하세요.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
await CapgoFilePicker.copyFile({ from: '/source/file.pdf', to: '/destination/file.pdf', overwrite: true});checkPermissions
섹션 제목 “checkPermissions”파일 읽기 권한 확인. 안드로이드 전용.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const status = await CapgoFilePicker.checkPermissions();console.log('Read permission:', status.readExternalStorage);requestPermissions
requestPermissions파일 읽기 권한 요청. 안드로이드 전용.
import { CapgoFilePicker } from '@capgo/capacitor-file-picker';
const status = await CapgoFilePicker.requestPermissions();if (status.readExternalStorage === 'granted') { console.log('Permission granted');}타입 참조
타입 참조PickFilesOptions
파일 선택 옵션파일 선택 옵션
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;}PickFilesResult
파일 선택 결과파일 선택 결과
export interface PickFilesResult { /** Array of picked files */ files: PickedFile[];}PickMediaOptions
__CAPGO_KEEP_1__ (미디어 선택)미디어 선택 옵션 (이미지/비디오).
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
__CAPGO_KEEP_1__ (디렉토리 선택 결과)디렉토리 선택 결과.
export interface PickDirectoryResult { /** The path to the selected directory */ path: string;}ConvertHeicToJpegOptions
__CAPGO_KEEP_1__ (HEIC를 JPEG로 변환 옵션)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
__CAPGO_KEEP_1__ (HEIC를 JPEG로 변환 결과)HEIC를 JPEG로 변환 결과.
export interface ConvertHeicToJpegResult { /** The path to the converted JPEG file */ path: string;}CopyFileOptions
__CAPGO_KEEP_1____CAPGO_KEEP_2__
export interface CopyFileOptions { /** Source file path */ from: string; /** Destination file path */ to: string; /** * Whether to overwrite if destination exists. * @default false */ overwrite?: boolean;}PermissionStatus
__CAPGO_KEEP_3____CAPGO_KEEP_4__
export interface PermissionStatus { /** Whether permission to read media files is granted */ readExternalStorage: PermissionState; /** Whether permission to access media location is granted */ accessMediaLocation?: PermissionState;}PickerDismissedListener
__CAPGO_KEEP_5____CAPGO_KEEP_0__
export type PickerDismissedListener = (event: null) => void;PickedFile
__CAPGO_KEEP_0____CAPGO_KEEP_7__
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. 업스트림에서 pubic API이 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속권한 상태가 있는 경우 Getting Started __CAPGO_KEEP_0__와 __CAPGO_KEEP_1__을 연결하여 저장 및 파일 처리를 계획하세요. Using @capgo/capacitor-file-picker capgo/capacitor-file-picker의 원생 기능을 사용하기 위해 @capgo/capacitor-data-storage-sqlite capgo/capacitor-data-storage-sqlite의 구현 세부 사항을 위해 Using @capgo/capacitor-data-storage-sqlite capgo/capacitor-data-storage-sqlite의 원생 기능을 사용하기 위해 @capgo/capacitor-file capgo/capacitor-file의 구현 세부 사항을 위해 Using @capgo/capacitor-file capgo/capacitor-file의 원생 기능을 사용하기 위해