xcos

package
v0.0.0-...-2beabf4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CosPathPrefix cos路径前缀
	CosPathPrefix = "cos:/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketObjectList

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

BucketObjectList 存储桶对象列表

func (*BucketObjectList) Iterator

func (l *BucketObjectList) Iterator() (<-chan *cos.Object, func(), func() error)

Iterator 返回对象迭代器

type Client

type Client struct {
	*object.Client
	// contains filtered or unexported fields
}

Client cos client

func New

func New(client *object.Client, config *object.Config) *Client

New 新建Client

func (*Client) Create

func (c *Client) Create(key string, r io.Reader) (etag string, err error)

Create 创建文件

func (*Client) DeleteMulti

func (c *Client) DeleteMulti(keys ...string) (*cos.ObjectDeleteMultiResult, error)

DeleteMulti 删除多个对象

func (*Client) Exists

func (c *Client) Exists(key string) bool

Exists 获取 cos 对象元数据

func (*Client) GetObjectPresignedURL

func (c *Client) GetObjectPresignedURL(key string, expire time.Duration) (*url.URL, error)

GetObjectPresignedURL 得到获取对象的预签名链接

func (*Client) Head

func (c *Client) Head(key string) (*ObjectMetaData, error)

Head 获取 cos 对象元数据

func (*Client) NewBucketObjectList

func (c *Client) NewBucketObjectList(prefix string) *BucketObjectList

NewBucketObjectList 新建一个桶对象列表

type CosFileResource

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

CosFileResource Cos文件资源

func NewCosFileResourceHandler

func NewCosFileResourceHandler(client *Client) *CosFileResource

NewCosFileResourceHandler 新建cos文件处理器

func (*CosFileResource) CanHandle

func (h *CosFileResource) CanHandle(path string) bool

CanHandle 文件资源处理接口

func (*CosFileResource) ContentLength

func (h *CosFileResource) ContentLength(path string) (length int64, err error)

ContentLength 文件资源处理接口

func (*CosFileResource) CreateFile

func (h *CosFileResource) CreateFile(path string, reader io.Reader) (etag string, err error)

CreateFile 文件资源处理接口

func (*CosFileResource) EntityTag

func (h *CosFileResource) EntityTag(path string) (etag string, err error)

EntityTag 文件资源处理接口

func (*CosFileResource) IsModified

func (h *CosFileResource) IsModified(path string, etag string) (ok bool, err error)

IsModified 文件资源处理接口

func (*CosFileResource) OpenForRead

func (h *CosFileResource) OpenForRead(path string) (reader io.ReadCloser, err error)

OpenForRead 文件资源处理接口

type ObjectMetaData

type ObjectMetaData struct {
	ContentType   string
	ContentLength int64
	ETag          string
	LastModified  time.Time
}

ObjectMetaData 对象元数据

Jump to

Keyboard shortcuts

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