Documentation
¶
Index ¶
- type Uploader
- func (u *Uploader) UploadDir(ctx context.Context, localDir, bucket, prefix, contentType string) error
- func (u *Uploader) UploadFile(ctx context.Context, localPath, bucket, key, contentType string) error
- func (u *Uploader) UploadStream(ctx context.Context, r io.Reader, bucket, key, contentType string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Uploader ¶
type Uploader struct {
// contains filtered or unexported fields
}
Uploader 包装 s3manager,提供单文件/目录上传。 s3 字段声明为 manager.UploadAPIClient 接口(而非具体 *s3.Client), 使上传路径可在测试中用 mock 覆盖;真实客户端天然满足该接口。
func (*Uploader) UploadDir ¶
func (u *Uploader) UploadDir(ctx context.Context, localDir, bucket, prefix, contentType string) error
UploadDir 递归上传本地目录到 bucket 下的 prefix。contentType 非空时应用到 目录内全部文件,为空则逐文件各自判定。
Click to show internal directories.
Click to hide internal directories.