Getting Started
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트를 복사합니다.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-file`
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/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 도움을 받는 설치를 사용하여 플러그인을 설치할 수 있습니다. 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` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 설명을 따라하세요.
bun add @capgo/capacitor-filebunx cap syncImport
Import 섹션import { CapacitorFile } from '@capgo/capacitor-file';API 개요
API 개요 섹션requestFileSystem
Import 섹션__CAPGO_KEEP_0__을 요청합니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.requestFileSystem({} as RequestFileSystemOptions);resolveLocalFileSystemURL
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__ URL을 엔트리로 해결합니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.resolveLocalFileSystemURL({} as ResolveURLOptions);getFile
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 가져옵니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getFile({} as GetFileOptions);getDirectory
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 가져옵니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getDirectory({} as GetDirectoryOptions);readFile
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 텍스트 또는 base64 형식으로 읽습니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.readFile({} as ReadFileOptions);readAsDataURL
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 데이터 URL 형식으로 읽습니다 (base64 형식의 MIME 타입 접두사).
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.readAsDataURL({} as ReadFileOptions);writeFile
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 파일에 쓰세요.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.writeFile({} as WriteFileOptions);appendFile
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__을 파일에 추가하세요.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.appendFile({} as WriteFileOptions);deleteFile
__CAPGO_KEEP_2__ 섹션__CAPGO_KEEP_0__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.deleteFile({} as DeleteFileOptions);mkdir
__CAPGO_KEEP_2____CAPGO_KEEP_3__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.mkdir({} as MkdirOptions);rmdir
__CAPGO_KEEP_2____CAPGO_KEEP_4__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.rmdir({} as DeleteDirectoryOptions);readdir
__CAPGO_KEEP_2____CAPGO_KEEP_5__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.readdir({} as ReaddirOptions);stat
__CAPGO_KEEP_2____CAPGO_KEEP_0__을(를) 파일 또는 디렉토리에 대한 정보를 가져옵니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.stat({} as StatOptions);getMetadata
getMetadata__CAPGO_KEEP_0__을(를) 파일 또는 디렉토리에 대한 정보를 가져옵니다. stat()의 별칭입니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getMetadata({} as StatOptions);rename
renamerename
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.rename({} as RenameOptions);__CAPGO_KEEP_1__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.move({} as RenameOptions);__CAPGO_KEEP_0__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.copy({} as CopyOptions);exists
__CAPGO_KEEP_1____CAPGO_KEEP_2__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.exists({} as ExistsOptions);getUri
__CAPGO_KEEP_3____CAPGO_KEEP_0__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getUri({} as GetUriOptions);truncate
__CAPGO_KEEP_1____CAPGO_KEEP_4__
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.truncate({} as TruncateOptions);getDirectories
__CAPGO_KEEP_3__모든 파일 시스템 디렉토리 가져오기.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getDirectories();getFreeDiskSpace
getFreeDiskSpace바이트 단위의 사용 가능한 디스크 공간 가져오기.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.getFreeDiskSpace();checkPermissions
checkPermissions파일 작업에 대한 현재 권한 상태 확인. 안드로이드에서는 외부 저장소 권한을 확인합니다. iOS와 웹에서는 특별한 권한이 필요하지 않기 때문에 항상 '허용'을 반환합니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.checkPermissions();requestPermissions
requestPermissions파일 작업에 대한 권한 요청. 안드로이드에서는 앱의 개인 디렉토리 외의 파일에 접근하기 위해 필요한 외부 저장소 권한을 요청합니다. iOS와 웹에서는 특별한 권한이 필요하지 않기 때문에 항상 '허용'을 반환합니다.
import { CapacitorFile } from '@capgo/capacitor-file';
await CapacitorFile.requestPermissions();타입 참조
Type Reference 섹션RequestFileSystemOptions
RequestFileSystemOptions 섹션파일 시스템 요청 옵션.
export interface RequestFileSystemOptions { /** The type of file system to request */ type: FileSystemType; /** Requested size in bytes (may not be enforced on all platforms) */ size?: number;}FileSystem
FileSystem 섹션파일 시스템을 나타냅니다.
export interface FileSystem { /** The name of the file system */ name: string; /** The root directory of the file system */ root: DirectoryEntry;}ResolveURLOptions
ResolveURLOptions 섹션URL을 엔트리로 변환하는 옵션.
export interface ResolveURLOptions { /** The URL to resolve (file:// or cdvfile://) */ url: string;}Entry
Entry 섹션파일 또는 디렉토리 엔트리를 나타냅니다.
export interface Entry { /** True if this is a file */ isFile: boolean; /** True if this is a directory */ isDirectory: boolean; /** The name of the file or directory */ name: string; /** The full path relative to the filesystem root */ fullPath: string; /** The native file:// URI */ nativeURL: string;}GetFileOptions
__CAPGO_KEEP_1__ (파일 가져오기 옵션)파일 가져오기 옵션입니다.
export interface GetFileOptions { /** Path to the file */ path: string; /** Base directory */ directory?: Directory; /** Options for creating the file */ options?: GetOptions;}FileEntry
__CAPGO_KEEP_1__ (파일 엔트리)파일 엔트리를 나타냅니다.
export interface FileEntry extends Entry { isFile: true; isDirectory: false;}GetDirectoryOptions
__CAPGO_KEEP_1__ (디렉토리 가져오기 옵션)디렉토리 가져오기 옵션입니다.
export interface GetDirectoryOptions { /** Path to the directory */ path: string; /** Base directory */ directory?: Directory; /** Options for creating the directory */ options?: GetOptions;}DirectoryEntry
__CAPGO_KEEP_1__ (디렉토리 엔트리)디렉토리 엔트리를 나타냅니다.
export interface DirectoryEntry extends Entry { isFile: false; isDirectory: true;}ReadFileOptions
__CAPGO_KEEP_1__ (파일 읽기 옵션)파일을 읽기 위한 옵션입니다.
export interface ReadFileOptions { /** Path to the file */ path: string; /** Base directory */ directory?: Directory; /** Encoding for text files (omit for binary/base64) */ encoding?: Encoding; /** Byte offset to start reading from (default: 0) */ offset?: number; /** Number of bytes to read (default: read to end of file) */ length?: number;}ReadFileResult
__CAPGO_KEEP_1__ (파일 읽기 결과)파일을 읽은 결과입니다.
export interface ReadFileResult { /** File contents as string (text) or base64 (binary) */ data: string;}WriteFileOptions
__CAPGO_KEEP_1__ (파일 쓰기 옵션)파일을 쓰기 위한 옵션입니다.
export interface WriteFileOptions { /** Path to the file */ path: string; /** Base directory */ directory?: Directory; /** Data to write (string for text, base64 for binary) */ data: string; /** Encoding for text files */ encoding?: Encoding; /** If true, append to existing file instead of overwriting */ append?: boolean; /** Create intermediate directories if they don't exist */ recursive?: boolean; /** Byte position to start writing at (for random access writes). If not specified, writes from beginning or appends based on 'append' flag */ position?: number;}WriteFileResult
__CAPGO_KEEP_1__ (파일 쓰기 결과)파일을 쓴 결과입니다.
export interface WriteFileResult { /** The URI of the written file */ uri: string;}실질적인 진원지
실질적인 진원지란?이 페이지는 플러그인의 src/definitions.ts업스트림에서 공개된 API이 변경되면 다시 싱크를 실행해 주세요.
Getting Started에서 계속
Getting Started에서 계속이러한 기능을 사용하고 계신가요? Getting Started를 사용하여 파일 처리와 저장소 계획을 위해 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-file Using @capgo/capacitor-file Using @capgo/capacitor-file @capgo/capacitor-data-storage-sqlite capgo/capacitor-data-storage-sqlite 구현 세부 사항에 대한 자세한 내용은 Using @capgo/capacitor-data-storage-sqlite capgo/capacitor-data-storage-sqlite을 사용하는 native 기능에 대한 자세한 내용은 @capgo/capacitor-file capgo/capacitor-file 구현 세부 사항에 대한 자세한 내용은 @capgo/capacitor-uploader capgo/capacitor-uploader 구현 세부 사항에 대한 자세한 내용은