Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) AbortMultipartUpload(ctx context.Context, objectName, uploadID string) error
- func (c *Client) CompleteMultipartUpload(ctx context.Context, objectName, uploadID string, parts []Part) error
- func (c *Client) DeleteFile(ctx context.Context, objectName string) error
- func (c *Client) DownloadFile(ctx context.Context, objectName string) ([]byte, error)
- func (c *Client) DownloadFileWithRange(ctx context.Context, objectName, rangeHeader string) ([]byte, error)
- func (c *Client) DownloadStream(ctx context.Context, objectName string) (io.ReadCloser, error)
- func (c *Client) GetPresignedURL(objectName string, expiresIn int64) (string, error)
- func (c *Client) HeadObject(ctx context.Context, objectName string) (http.Header, error)
- func (c *Client) InitiateMultipartUpload(ctx context.Context, objectName, contentType string) (string, error)
- func (c *Client) PutObjectPresign(objectName string, expiresIn int64, contentType string) (string, error)
- func (c *Client) UploadFile(ctx context.Context, objectName string, data io.Reader, contentType string) error
- func (c *Client) UploadPart(ctx context.Context, objectName, uploadID string, partNumber int, ...) (string, error)
- type CompleteMultipartUpload
- type Config
- type Part
Constants ¶
View Source
const ( DefaultRegion = "auto" DefaultUseSSL = true MaxPresignedExpires = 7 * 24 * 60 * 60 // 7 days // UnsignedPayload 是 AWS SigV4 规范中定义的官方特殊常量 // 当使用 HTTPS 传输时,向 S3 声明 "UNSIGNED-PAYLOAD" 可以跳过客户端对文件内容的全量 SHA-256 计算 // 这样能实现 O(1) 内存占用,极大提升大文件与流式上传的传输性能,同时由于现代Https/TLS协议的安全性,无需担心数据完整性问题 UnsignedPayload = "UNSIGNED-PAYLOAD" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AbortMultipartUpload ¶
func (*Client) CompleteMultipartUpload ¶
func (*Client) DeleteFile ¶
func (*Client) DownloadFile ¶
func (*Client) DownloadFileWithRange ¶
func (*Client) DownloadStream ¶
func (*Client) GetPresignedURL ¶
GetPresignedURL 生成带签名的临时下载链接
func (*Client) HeadObject ¶
func (*Client) InitiateMultipartUpload ¶
func (*Client) PutObjectPresign ¶
func (c *Client) PutObjectPresign(objectName string, expiresIn int64, contentType string) (string, error)
PutObjectPresign 生成带签名的预上传链接
func (*Client) UploadFile ¶
func (c *Client) UploadFile( ctx context.Context, objectName string, data io.Reader, contentType string, ) error
----------------------------------------------------------------------------- Core Object API -----------------------------------------------------------------------------
type CompleteMultipartUpload ¶
type Config ¶
type Config struct {
AccessKeyID string
AccessKeySecret string
Bucket string
Region string
Endpoint string
UseSSL bool
UsePathStyle bool // 是否使用<路径模式> (默认<虚拟主机模式>)
}
----------------------------------------------------------------------------- 配置与客户端定义 (Config & Client) -----------------------------------------------------------------------------
Click to show internal directories.
Click to hide internal directories.