aliyunoss

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package aliyunoss 阿里云OSS相关功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	EndPoint        string
	AccessKeyID     string
	AccessKeySecret string
	Bucket          string
	Object          string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endPoint, accessKeyID, accessKeySecret, bucket, object string) (client *Client)

初始化阿里云OSS客户端

endPoint: 访问域名

accessKeyID: 访问ID

accessKeySecret: 访问密钥

bucket: 存储空间

object: 对象

func (*Client) DeleteFile

func (o *Client) DeleteFile(file string) (err error)

DeleteFile 删除文件

file 文件名称: upfile.txt

返回参数 err 错误信息

func (*Client) PutFromFile

func (o *Client) PutFromFile(file string, saveFile string) (saveURL string, err error)

PutFromFile 上传文件至阿里云OSS,数据源为本地文件

file 文件路径: /home/upfile.txt 或者 upfile.txt

saveFile 保存文件名,文件名格式,自己可以改,建议保证唯一性

返回参数 saveURL 成功上传后保存路径

func (*Client) PutFromStream

func (o *Client) PutFromStream(file *multipart.FileHeader, saveFile string) (saveURL string, err error)

PutFromStream 上传文件至阿里云OSS,数据源为本地文件

file 文件流,请求表单提交的文件流

saveFile 保存文件名,文件名格式,自己可以改,建议保证唯一性

返回参数 saveURL 成功上传后保存路径

Jump to

Keyboard shortcuts

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