qiniu

package
v0.0.0-...-795cddc Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotQiniuHost = fmt.Errorf("not qiniu host")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	AccessKey string `json:"access_key" yaml:"access_key"`
	SecretKey string `json:"secret_key" yaml:"secret_key"`
	Bucket    string `json:"bucket" yaml:"bucket"`
	Dir       string `json:"dir" yaml:"dir"`
	Domain    string `json:"domain" yaml:"domain"`
	Host      string `json:"host" yaml:"host"`
}

type Qiniu

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

func NewQiniu

func NewQiniu(config *Config) *Qiniu

func (*Qiniu) ExtractKeyFromURL

func (n *Qiniu) ExtractKeyFromURL(uri string) string

func (*Qiniu) ExtractKeyFromURLWithMode

func (n *Qiniu) ExtractKeyFromURLWithMode(uri string, strict bool) (string, error)

func (*Qiniu) GenerateImageURL

func (n *Qiniu) GenerateImageURL(key string, width int) string

func (*Qiniu) GenerateURL

func (n *Qiniu) GenerateURL(key string) string

func (*Qiniu) GenerateURLs

func (n *Qiniu) GenerateURLs(keys []string) []string

func (*Qiniu) GenerateUploadToken

func (n *Qiniu) GenerateUploadToken(fileName string, dir string, nameBuilder func(fileName string, dir ...string) string) store.FileUploadToken

func (*Qiniu) UploadFile

func (n *Qiniu) UploadFile(ctx context.Context, file io.Reader, size int64, key string) (*store.FileUploadResult, error)

func (*Qiniu) UploadLocalFile

func (n *Qiniu) UploadLocalFile(ctx context.Context, file string, key string) (*store.FileUploadResult, error)

Jump to

Keyboard shortcuts

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