minio

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Minio

type Minio struct {
	// contains filtered or unexported fields
}

func New

func New(Endpoint string, AccessKeyID string, SecretAccessKey string, Token string, UseSSL bool) *Minio

func (*Minio) ContentType

func (m *Minio) ContentType(suf string) (string, error)

func (*Minio) DeleteBucket

func (m *Minio) DeleteBucket(ctx context.Context, BucketName string) error

DeleteBucket : 删除指定bucket

func (*Minio) DeleteBucketFile

func (m *Minio) DeleteBucketFile(ctx context.Context, BucketName string, FileName string) error

DeleteBucketFile : 删除指定bucket下的文件

func (*Minio) Download

func (m *Minio) Download(ctx context.Context, bucket string, object string, path string) error

Download : 下载文件到本地路径 @params ctx: 上下文 @params bucket: 桶名称 @params object: 文件名称 @params path: 存储路径

func (*Minio) ListBucketObjects

func (m *Minio) ListBucketObjects(ctx context.Context, BucketName string) []vm.ObjectInfo

ListBucketObjects : 获取指定bucket下的所有文件

func (*Minio) ListBuckets

func (m *Minio) ListBuckets(ctx context.Context) ([]vm.BucketInfo, error)

ListBuckets : 获取所有bucket

func (*Minio) MakeBucket

func (m *Minio) MakeBucket(ctx context.Context, bucket string, policy Policy, location string) error

MakeBucket : 创建一个桶 @params ctx: 上下文 @params bucket: 桶名称 @params policy: 策略(public、private) @params location: 位置

func (*Minio) PreSignedGetObject

func (m *Minio) PreSignedGetObject(ctx context.Context, bucket string, object string, ex time.Duration) (*url.URL, error)

PreSignedGetObject : 获取文件签名(临时访问路径) @params ctx: 上下文 @params bucket: 桶名称 @params object: 文件名称 @params ex: 过期时间,至少30s,小于30s,则默认30s

func (*Minio) SetBucketPolicy

func (m *Minio) SetBucketPolicy(ctx context.Context, bucket string, policy Policy) error

SetBucketPolicy : 设置桶的访问权限 @params ctx: 上下文 @params bucket: 桶名称 @params policy: 策略(public、private) @return error:

func (*Minio) UploadByByte

func (m *Minio) UploadByByte(ctx context.Context, file io.Reader, size int64, bucket string, object string) (vm.UploadInfo, error)

UploadByByte : 以字节上传文件 @params ctx: 上下文 @params file: 文件 @params size: 文件大小 @params bucket: 桶名称 @params object: 文件名称

func (*Minio) UploadByName

func (m *Minio) UploadByName(ctx context.Context, bucket string, object string, file string) (vm.UploadInfo, error)

UploadByName : 以文件路径上传文件 @params ctx: 上下文 @params bucket: 桶名称 @params object: 文件名称 @params file: 文件路径

type Policy

type Policy int
const (
	Public Policy = iota + 1
	Private
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL