Skip to content

Getting Started

GitHub

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

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

터미널 창
bun add @capgo/capacitor-firebase-storage
bunx cap sync
import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';

파일 삭제

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.deleteFile({} as DeleteFileOptions);

파일 다운로드 URL 가져오기

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.getDownloadUrl({} as GetDownloadUrlOptions);

파일 메타데이터 가져오기

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.getMetadata({} as GetMetadataOptions);

listFiles

listFiles

폴더 내의 파일 목록을 표시합니다.

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.listFiles({} as ListFilesOptions);

updateMetadata

updateMetadata

파일의 메타데이터를 업데이트합니다.

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.updateMetadata({} as UpdateMetadataOptions);

uploadFile

uploadFile

파일을 업로드합니다.

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.uploadFile({} as UploadFileOptions, {} as UploadFileCallback);

useEmulator

useEmulator

앱을 Cloud Storage 에뮬레이터와 통신하도록 구성합니다.

안드로이드에서 클리어 텍스트 트래픽을 허용해야 합니다. Capacitor 구성에서:

{
server: {
cleartext: true
}
}

__CAPGO_KEEP_1__

import { FirebaseStorage } from '@capgo/capacitor-firebase-storage';
await FirebaseStorage.useEmulator({} as UseEmulatorOptions);

__CAPGO_KEEP_2__

__CAPGO_KEEP_3__

DeleteFileOptions

__CAPGO_KEEP_4__
export interface DeleteFileOptions {
/**
* The full path to the file to delete, including the file name.
*
* @since 5.3.0
* @example 'mountains.png'
* @example 'images/mountains.png'
*/
path: string;
}

GetDownloadUrlOptions

__CAPGO_KEEP_5__
export interface GetDownloadUrlOptions {
/**
* The full path to the file to get the download url for, including the file name.
*
* @since 5.3.0
* @example 'mountains.png'
* @example 'images/mountains.png'
*/
path: string;
}

GetDownloadUrlResult

__CAPGO_KEEP_6__
export interface GetDownloadUrlResult {
/**
* The download url for the file.
*
* @since 5.3.0
*/
downloadUrl: string;
}

GetMetadataOptions

__CAPGO_KEEP_7__
export interface GetMetadataOptions {
/**
* The full path to the file to get the metadata for, including the file name.
*
* @since 5.3.0
* @example 'mountains.png'
* @example 'images/mountains.png'
*/
path: string;
}
export interface GetMetadataResult {
/**
* The bucket this file is contained in.
*
* @since 5.3.0
*/
bucket: string;
/**
* The timestamp at which the file was created in milliseconds since the epoch.
*
* @since 5.3.0
* @example 1697304435933
*/
createdAt?: number;
/**
* The object's generation.
*
* @since 5.3.0
* @see https://cloud.google.com/storage/docs/metadata#generation-number
*/
generation: string;
/**
* The md5 hash of the file.
*
* @since 5.3.0
*/
md5Hash?: string;
/**
* The object's metadata generation.
*
* @since 5.3.0
* @see https://cloud.google.com/storage/docs/metadata#generation-number
*/
metadataGeneration: string;
/**
* The short name of this file, which is the last component of the full path.
*
* @since 5.3.0
* @example 'mountains.png'
*/
name?: string;
/**
* The full path to the file, including the file name.
*
* @since 5.3.0
* @example 'images/mountains.png'
*/
path?: string;
/**
* The size of the file in bytes.
*
* @since 5.3.0
*/
size: number;
/**
* The timestamp at which the file was last updated in milliseconds since the epoch.
*
* @since 5.3.0
* @example 1697304435933
*/
updatedAt: number;
/**
* Served as the `Cache-Control` header on object download.
*
* @since 6.1.0
*/
cacheControl?: string;
/**
* Served as the `Content-Disposition` header on object download.
*
* @since 6.1.0
*/
contentDisposition?: string;
/**
* Served as the `Content-Encoding` header on object download.
*
* @since 6.1.0
*/
contentEncoding?: string;
/**
* Served as the `Content-Language` header on object download.
*
* @since 6.1.0
*/
contentLanguage?: string;
/**
* Served as the `Content-Type` header on object download.
*
* @since 6.1.0
*/
contentType?: string;
/**
* Additional user-defined custom metadata.
*
* @since 6.1.0
*/
customMetadata?: { [key: string]: string };
}
export interface ListFilesOptions {
/**
* The full path to the directory to list files for.
*
* @since 5.3.0
*/
path: string;
/**
* The maximum number of results to return.
*
* @since 5.3.0
* @default 1000
*/
maxResults?: number;
/**
* The page token, returned by a previous call to this method.
* If provided, listing is resumed from the previous position.
*
* @since 5.3.0
*/
pageToken?: string;
}
export interface ListFilesResult {
/**
* The list of files in the directory.
*
* @since 5.3.0
*/
items: StorageReference[];
/**
* If set, there might be more results for this list.
* Use this token to resume the list.
*
* @since 5.3.0
*/
nextPageToken?: string;
}
export interface UpdateMetadataOptions {
/**
* The full path to the file to update the metadata for, including the file name.
*
* @since 5.3.0
*/
path: string;
/**
* The metadata to update.
*
* @since 5.3.0
*/
metadata: SettableMetadata;
}
export interface UploadFileOptions {
/**
* The data to upload.
*
* Only available for Web.
*
* @since 5.3.0
*/
blob?: Blob;
/**
* The full path where data should be uploaded, including the file name.
*
* @since 5.3.0
* @example 'mountains.png'
* @example 'images/mountains.png'
*/
path: string;
/**
* The uri to the file to upload.
*
* Only available for Android and iOS.
*
* @since 5.3.0
* @example 'content://com.google.android.apps.photos.contentprovider/-1/1/content://media/external/images/media/1000000214/ORIGINAL/NONE/image/.png/mountains'
* @example 'file:///var/mobile/Containers/Data/Application/E397A70D-67E4-4258-236E-W1D9E12111D4/Library/Caches/092F8464-DE60-40B3-8A23-EB83160D9F9F/mountains.png'
*/
uri?: string;
/**
* The metadata to set for the file.
*
* @since 5.4.0
*/
metadata?: UploadMetadata;
}
export type UploadFileCallback = (event: UploadFileCallbackEvent | null, error: any) => void;
export type CallbackId = string;
export interface UseEmulatorOptions {
/**
* The emulator host without any port or scheme.
*
* Note when using a Android Emulator device: 10.0.2.2 is the special IP address to connect to the 'localhost' of the host computer.
*
* @since 6.1.0
* @example "127.0.0.1"
*/
host: string;
/**
* The emulator port.
*
* @since 6.1.0
* @default 9199
* @example 9199
*/
port?: number;
}

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

Getting Started에서 계속하기

Getting Started에서 계속하기라는 섹션

__CAPGO_KEEP_0__의 공개 버전이 업스트림에서 변경될 때 다시 싱크를 실행하세요. 만약에 __CAPGO_KEEP_0__의 공개 버전이 업스트림에서 변경될 때 다시 싱크를 실행하세요.가 사용중이라면 Getting Started __CAPGO_KEEP_0__와 __CAPGO_KEEP_1__을 연결하여 저장 및 파일 처리를 계획하세요. @capgo/capacitor-data-storage-sqlite @capgo/capacitor-data-storage-sqlite의 구현 세부 사항을 참조하세요. @capgo/capacitor-data-storage-sqlite을 사용하세요. @capgo/capacitor-data-storage-sqlite의 원시 기능을 사용하세요. @capgo/capacitor-file @capgo/capacitor-file의 구현 세부 사항을 참조하세요. @capgo/capacitor-file을 사용하세요. @capgo/capacitor-file의 원시 기능을 사용하세요. @capgo/capacitor-file을 사용하여 업로드를 처리하세요. @capgo/capacitor-uploader의 구현 세부 사항을 참조하세요.