oss

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 阿里云
	OSSProviderTypeAliyun = 1

	// 亚马逊
	OSSProviderTypeAmazon = 2

	// 配置Key
	OSSConfKeyAliyun = "oss.aliyun"

	OSSConfKeyAws = "oss.aws"
)
View Source
const (
	OSSConfKeyTxyun = "oss.txyun"
)

Variables

View Source
var (
	AccessKeyID     string
	AccessKeySecret string
	BucketName      string
	BucketUrl       string
	EndPoint        string
	PathPrefix      string
)
View Source
var (
	OsType     = runtime.GOOS
	RootPath   string
	DataPath   string
	UploadPath string
)

Functions

func AliyunUploadStream

func AliyunUploadStream(ossFileName string, r io.Reader) (string, error)

上传文件流

func AliyunUploadString

func AliyunUploadString(key string, value string) error

上传字符串

func Base64Upload

func Base64Upload(key string, value string) (string, error)

上传字符串

func FileUpload

func FileUpload(fileName string, r io.Reader) (string, error)

上传文件流

func GetDataPath

func GetDataPath() string

func GetDownLoadPath

func GetDownLoadPath() string

func GetExportPath

func GetExportPath() string

func GetRootPath

func GetRootPath() string

func GetUploadPath

func GetUploadPath() string

func StreamUpload

func StreamUpload(ossFileName string, r io.Reader) (string, error)

文件流方式上传(本地不存文件)

func UploadFileToTxyun

func UploadFileToTxyun(filePath string) (string, error)

上传文件

func UploadToAws

func UploadToAws(fileName string, r io.Reader) (string, error)

上传文件流

func UploadToTxyun

func UploadToTxyun(fileName string, r io.Reader) (string, error)

上传文件流

func UploadToTxyunWithPath

func UploadToTxyunWithPath(path, fileName string, r io.Reader) (string, error)

上传到腾讯云OSS指定路径

Types

type AwsConf

type AwsConf struct {
	AccessKeyId     string
	AccessKeySecret string
	EndPoint        string
	Region          string
	BucketName      string
	UploadPath      string
}

type TxyunConf

type TxyunConf struct {
	BucketUrl  string
	UploadPath string
	SecretId   string
	SecretKey  string
	Timeout    time.Duration
}

type UploadConf

type UploadConf struct {
	AccessKeyId     string
	AccessKeySecret string
	BucketName      string
	Domain          string // 域名
	EndPoint        string
	UploadPath      string // oss上传路径
	Timeout         int32  // 上传超时
	Region          string // 地区
}

上传配置

Jump to

Keyboard shortcuts

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