s3

package
v0.0.0-...-746aa3e Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	Policy *model.Policy
	// contains filtered or unexported fields
}

Driver 适配器模板

func (Driver) CORS

func (handler Driver) CORS() error

CORS 创建跨域策略

func (Driver) Delete

func (handler Driver) Delete(ctx context.Context, files []string) ([]string, error)

Delete 删除一个或多个文件, 返回未删除的文件,及遇到的最后一个错误

func (Driver) Get

func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser, error)

Get 获取文件

func (*Driver) InitS3Client

func (handler *Driver) InitS3Client() error

InitS3Client 初始化S3会话

func (Driver) List

func (handler Driver) List(ctx context.Context, base string, recursive bool) ([]response.Object, error)

List 列出给定路径下的文件

func (Driver) Meta

func (handler Driver) Meta(ctx context.Context, path string) (*MetaData, error)

Meta 获取文件信息

func (Driver) Put

func (handler Driver) Put(ctx context.Context, file io.ReadCloser, dst string, size uint64) error

Put 将文件流保存到指定目录

func (Driver) Source

func (handler Driver) Source(
	ctx context.Context,
	path string,
	baseURL url.URL,
	ttl int64,
	isDownload bool,
	speed int,
) (string, error)

Source 获取外链URL

func (Driver) Thumb

func (handler Driver) Thumb(ctx context.Context, path string) (*response.ContentResponse, error)

Thumb 获取文件缩略图

func (Driver) Token

func (handler Driver) Token(ctx context.Context, TTL int64, key string) (serializer.UploadCredential, error)

Token 获取上传策略和认证Token

type MetaData

type MetaData struct {
	Size uint64
	Etag string
}

MetaData 文件信息

type UploadPolicy

type UploadPolicy struct {
	Expiration string        `json:"expiration"`
	Conditions []interface{} `json:"conditions"`
}

UploadPolicy S3上传策略

Jump to

Keyboard shortcuts

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