Versions in this module Expand all Collapse all v0 v0.2.0 Nov 7, 2026 Changes in this version + const ProviderAWS + const ProviderAliyun + const ProviderAzure + const ProviderTencent + const ProviderWechat + var ErrInvalidConfig = errors.New("upload: invalid config") + var ErrInvalidRange = errors.New("upload: invalid range") + var ErrNotFound = errors.New("upload: object not found") + var ErrNotInitialized = errors.New("upload: not initialized") + var ErrObjectTooLarge = errors.New("upload: object too large for simple upload") + var ErrUnsupported = errors.New("upload: unsupported operation") + func PublicURLFromHost(host, key string) string + func SetMemObject(s Storage, key string, data []byte) error + type AWSConfig struct + AccessKeyID string + Bucket string + CDNHost string + Endpoint string + Region string + SecretAccessKey string + SessionToken string + type AliyunConfig struct + AccessKeyID string + AccessKeySecret string + Bucket string + CDNHost string + Endpoint string + type AzureConfig struct + AccountKey string + AccountName string + CDNHost string + Container string + Endpoint string + type COSConfig struct + AppID string + BaseURL string + Bucket string + CDNHost string + Region string + SecretID string + SecretKey string + type Config struct + AWS AWSConfig + Aliyun AliyunConfig + Azure AzureConfig + Multipart MultipartConfig + Provider ProviderSettings + Retry RetryConfig + Tencent COSConfig + Wechat COSConfig + func ConfigDefault() Config + func (c *Config) Validate() error + type GetOption func(*getOptions) + func GetWithMultipart() GetOption + type ListOption func(*listOptions) + func WithContinuationToken(token string) ListOption + func WithDelimiter(d string) ListOption + func WithMaxKeys(n int) ListOption + type ListPage struct + IsTruncated bool + NextContinuationToken string + type MultipartConfig struct + Concurrency int + DownloadPartSize int64 + PartSize int64 + Threshold int64 + type ObjectInfo struct + ETag string + Key string + LastModified int64 + Size int64 + type ProviderSettings struct + Name string + type PutOption func(*putOptions) + func WithContentLength(n int64) PutOption + func WithContentType(ct string) PutOption + func WithMultipart() PutOption + type RetryConfig struct + InitialDelay time.Duration + MaxAttempts int + MaxDelay time.Duration + Multiplier float64 + func DefaultRetryConfig() RetryConfig + type Storage interface + Close func() error + Delete func(ctx context.Context, key string) error + Download func(ctx context.Context, key string, w io.Writer, opts ...GetOption) error + DownloadLarge func(ctx context.Context, key string, w io.Writer, size int64, opts ...GetOption) error + List func(ctx context.Context, prefix string, opts ...ListOption) ([]ObjectInfo, *ListPage, error) + PublicURL func(key string) string + Upload func(ctx context.Context, key string, r io.Reader, opts ...PutOption) error + UploadLarge func(ctx context.Context, key string, r io.Reader, size int64, opts ...PutOption) error + func NewStorage(ctx context.Context, cfg Config) (Storage, error) + type Uploader interface + BaseURL func() string + CdnUrl func(path string) string + Upload func(ctx context.Context, path string, reader io.Reader) error + func AsUploader(s Storage) Uploader