oss

package
v0.0.0-...-445d29d Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

权限控制 https://help.aliyun.com/document_detail/609913.html

下载文件 https://help.aliyun.com/document_detail/32148.html

列举文件 https://help.aliyun.com/document_detail/88639.html

oss客户端,必须先调用 Init 初始化 https://help.aliyun.com/product/31815.html https://help.aliyun.com/document_detail/32144.html

数据处理 https://help.aliyun.com/document_detail/410762.html

上传文件 https://help.aliyun.com/document_detail/32147.html

Index

Constants

View Source
const (
	ACLPrivate         = oss.ACLPrivate         // 私有读,私有写,bucket默认
	ACLPublicRead      = oss.ACLPublicRead      // 公开读,私有写
	ACLPublicReadWrite = oss.ACLPublicReadWrite // 公开读,公开写
	ACLDefault         = oss.ACLDefault         // 适用于object,继承bucket权限,object默认
)

Access Control List权限

Variables

View Source
var Client *client

Functions

func Download

func Download(objectKey string, options ...oss.Option) error

Download 下载文件

func GetObject

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

GetObject 读取文件字节

func GetObjectStr

func GetObjectStr(objectKey string, options ...oss.Option) (string, error)

GetObjectStr 读取文件字符串

func Init

func Init(endpoint, accessKeyID, accessKeySecret, bucketName string) error

Init 初始化oss客户端 endpoint 是oss数据中心地址 例如https://oss-cn-hangzhou.aliyuncs.com https://help.aliyun.com/document_detail/31837.html

func InitEnv

func InitEnv() error

InitEnv 使用环境变量初始化oss客户端

func ListObjects

func ListObjects(prefix string) ([]oss.ObjectProperties, error)

ListObjects 获取对象列表,prefix不能以斜杆开头

func Modify

func Modify(f func([]byte) []byte, objectKey string, options ...oss.Option) error

Modify 修改文件,先读取文件字节,修改后上传 options 是读取文件的选项

func PutObject

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

PutObject 放文件,如果文件存在会覆盖

func PutObjectBytes

func PutObjectBytes(objectKey string, bs []byte, options ...oss.Option) error

PutObjectBytes 将bytes作为文件放到oss

func PutObjectFromFile

func PutObjectFromFile(objectKey, filePath string, options ...oss.Option) error

PutObjectFromFile 上传本地文件到oss objectKey 不能以斜杆开头

func PutObjectFromFileACL

func PutObjectFromFileACL(objectKey, filePath string, acl oss.ACLType) error

PutObjectFromFileACL 上传本地文件到oss,并修改acl权限

func PutObjectString

func PutObjectString(objectKey string, s string, options ...oss.Option) error

PutObjectString 将字符串作为文件放到oss

func SignURL

func SignURL(objectKey string, expiredInSec int64, options ...oss.Option) (string, error)

SignURL 生成私有文件访问地址

func VideoSnapshot

func VideoSnapshot(width, height int) string

VideoSnapshot 视频截帧参数值 https://help.aliyun.com/document_detail/64555.html 使用视频截帧时,按视频截帧截取的图片数量计费。 截图宽高都指定为0,使用视频宽高,一个指定为0,则自动计算 如果视频可以公开读,截图地址是在视频地址后加 ?x-oss-process=参数值

func VideoSnapshotSignURL

func VideoSnapshotSignURL(objectKey string, expiredInSec int64, width, height int) (string, error)

VideoSnapshotSignURL 生成私有文件视频截帧URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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