miniox

package
v0.0.0-...-774e91b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cfg

type Cfg struct {
	Address     string // 地址-必填(例 127.0.0.1:9000)
	Username    string // 账号-必填
	Password    string // 密码-必填
	Bucket      string // 桶名-必填
	Token       string // 默认无
	Location    string // 地点/服务
	Timeout     int    // 超时
	ContentType string // 文件类型
	TLS         bool   // 是否开启TLS(HTTPS)
}

func Load

func Load(cli *clientv3.Client, env string) *Cfg

func (*Cfg) NewClient

func (c *Cfg) NewClient() *Client

type Client

type Client struct {
	Bucket      string        // 桶名
	Location    string        // 地点/服务
	Timeout     time.Duration // 超时
	ContentType string
	// contains filtered or unexported fields
}

func (*Client) DelObject

func (c *Client) DelObject(ctx context.Context, names ...string) error

DelObject 删除对象

func (*Client) GetUrl

func (c *Client) GetUrl(ctx context.Context, name string, ops Options) string

GetUrl 获取地址

func (*Client) GetUrls

func (c *Client) GetUrls(ctx context.Context, names []string, ops Options) map[string]string

GetUrls 批量获取地址

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, f io.Reader, name string, size int64) error

Upload 上传/更新文件或者图片

type Options

type Options struct {
	Expires    int64 // 过期时间-单位分钟(默认30分钟)
	Width      int   // 指定宽
	Height     int   // 指定高
	IsDownload bool  // 是否下载。图片默认False.返回预览链接地址。文件或者下载图片可以为Ture为下载连接
}

Jump to

Keyboard shortcuts

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