Skip to main content

安裝

Add InsForge to your Swift Package Manager dependencies:

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
Log Levels: Log Destinations:
Use .info or .error in production to avoid exposing sensitive data in logs.

from()

取得儲存體桶的檔案 API 參考。

範例


儲存體桶操作

createBucket()

建立新的儲存體桶。

listBuckets()

列出所有儲存體桶名稱。

updateBucket()

更新儲存體桶的可見性。

deleteBucket()

刪除儲存體桶。

upload()

上傳檔案到儲存體桶。

參數

  • path (String) - 檔案的物件鍵/路徑
  • data (Data) - 要上傳的檔案資料
  • options (FileOptions, optional) - 上傳選項,包括 contentType

範例


download()

下載檔案為資料。

範例


list()

列出儲存體桶中的檔案。

參數

  • options (ListOptions, optional) - 選項,包括前置詞、限制、位移

範例


delete()

從儲存體刪除檔案。

範例


getPublicURL()

取得公共儲存體桶中檔案的公開 URL。

範例


上傳策略

取得大型檔案的上傳策略(直接或預簽署 URL)。

getUploadStrategy()

confirmUpload()

在上傳到 S3 後確認預簽署上傳。

下載策略

取得私人檔案的下載策略(直接或預簽署 URL)。

getDownloadStrategy()


選項參考

FileOptions

檔案上傳操作的選項。

BucketOptions

儲存體桶建立/更新的選項。

ListOptions

列出檔案的選項。

StoredFile 模型

儲存體操作的回應模型。