oss

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBucket

func CreateBucket(bucketName string) (err error)

func DeleteFile

func DeleteFile(objectName string) (err error)

func DownloadFile

func DownloadFile(objectName string, downloadedFileName string) (err error)

func GetObject

func GetObject(objectName string, options ...oss.Option) ([]byte, error)

func OnInit

func OnInit(config map[string]interface{}, option ...Option) (err error)

func UploadFile

func UploadFile(localFileName string, objectName string) (err error)

func UploadObject

func UploadObject(objectKey string, reader io.Reader, options ...oss.Option) (err error)

Types

type IOSS

type IOSS interface {
	CreateBucket(bucketName string) (err error)
	UploadObject(objectKey string, reader io.Reader, options ...oss.Option) (err error)
	UploadFile(objectName string, localFileName string) (err error)
	GetObject(objectName string, options ...oss.Option) ([]byte, error)
	DownloadFile(objectName string, downloadedFileName string) (err error)
	DeleteFile(objectName string) (err error)
}

func NewSys

func NewSys(option ...Option) (sys IOSS, err error)

type OSS

type OSS struct {
	Endpoint        string
	AccessKeyId     string
	AccessKeySecret string
	BucketName      string
	// contains filtered or unexported fields
}

func (*OSS) CreateBucket

func (this *OSS) CreateBucket(bucketName string) (err error)

创建存储空间。

func (*OSS) DeleteFile

func (this *OSS) DeleteFile(objectName string) (err error)

删除文件

func (*OSS) DownloadFile

func (this *OSS) DownloadFile(objectName string, downloadedFileName string) (err error)

下载文件。 <objectName>从OSS下载文件时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。

func (*OSS) GetObject

func (this *OSS) GetObject(objectName string, options ...oss.Option) ([]byte, error)

下载文件到缓存

func (*OSS) Init

func (this *OSS) Init() (err error)

func (*OSS) UploadFile

func (this *OSS) UploadFile(objectName string, localFileName string) (err error)

上传文件 <objectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 <localFileName>由本地文件路径加文件名包括后缀组成,例如/users/local/myfile.txt。 上传文件。

func (*OSS) UploadObject

func (this *OSS) UploadObject(objectKey string, reader io.Reader, options ...oss.Option) (err error)

上传对象 <objectName>上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg。 <localFileName>由本地文件路径加文件名包括后缀组成,例如/users/local/myfile.txt。 上传文件。

type Option

type Option func(*Options)

func SetAccessKeyId

func SetAccessKeyId(v string) Option

func SetAccessKeySecret

func SetAccessKeySecret(v string) Option

func SetBucketName

func SetBucketName(v string) Option

func SetEndpoint

func SetEndpoint(v string) Option

type Options

type Options struct {
	Endpoint        string
	AccessKeyId     string
	AccessKeySecret string
	BucketName      string
}

Jump to

Keyboard shortcuts

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