qiniu

package
v0.0.0-...-e7cf16d Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*urlhandler.Handler
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*Client, error)

func (*Client) DownloadFile

func (n *Client) DownloadFile(ctx context.Context, key string) (io.ReadCloser, error)

func (*Client) GenerateImageURL

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

func (*Client) GenerateUploadToken

func (n *Client) GenerateUploadToken(fileName string, dir string, nameBuilder func(fileName string, dir ...string) string) ([3]string, error)

func (*Client) UploadFile

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

func (*Client) UploadLocalFile

func (n *Client) UploadLocalFile(ctx context.Context, file string, key string) (string, error)

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"`

	PublicBase string `json:"public_base" yaml:"public_base"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳