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 模型

存储操作的响应模型。