qiniu

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZoneHuanan  = "huanan"
	ZoneHuadong = "huadong"
	ZoneHuabei  = "huabei"
)

Variables

View Source
var (
	ZoneMap = map[string]*storage.Region{
		"huanan":  &storage.ZoneHuanan,
		"huadong": &storage.ZoneHuadong,
		"huabei":  &storage.ZoneHuabei,
	}
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Uploader *storage.FormUploader
	Token    string
	Config   *Config
}

func (*Client) Delete

func (cloud *Client) Delete(fileName string) error

func (*Client) Download

func (cloud *Client) Download(fileName string) error

func (*Client) Upload

func (cloud *Client) Upload(file io.Reader, fileName string) (string, error)

如果存在同名且相同的文件,则直接返回url

type Config

type Config struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Bucket    string `json:"bucket"`
	// 空间对应机房
	Zone string `json:"zone"`
	// 是否使用https域名
	UseHTTPS bool `json:"use_https"`
	// 上传是否使用CDN上传加速
	UseCdnDomains bool `json:"use_cdn_domains"`
	// 域名地址,包含http://,通过查看外链可以看到,如:http://image-c4lms-qiniu.whereabouts.icu
	Domain string `json:"domain"`
}

Jump to

Keyboard shortcuts

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