跳转至

判断桶存在性

BucketExists(ctx context.Context, bucketName string) (found bool, err error)

列出所有存储桶。

参数

参数 类型 描述
ctx context.Context 自定义上下文,用于超时或取消调用
bucketName string 存储桶名称

返回值

参数 类型 描述
found bool 指示存储桶是否存在
err error 标准错误

示例

found, err := minioClient.BucketExists(context.Background(), "mybucket")
if err != nil {
    fmt.Println(err)
    return
}
if found {
    fmt.Println("Bucket found")
}