Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateUrl ¶
func PrivateUrl(info UrlApiInfo) (fileUrl string)
PrivateUrl 返回私有空间的下载链接, 也可以用于公有空间的下载
func PublicUrl ¶
func PublicUrl(info UrlApiInfo) (fileUrl string)
PublicUrl 返回公有空间的下载链接,不可以用于私有空间的下载
Types ¶
type ApiInfo ¶
type ApiInfo struct {
Bucket string `json:"bucket"` // 文件所在 bucket 【必填】
Key string `json:"key"` // 文件被保存的 key 【必填】
IsPublic bool `json:"-"` // 是否使用共有链接 【必填】
HostProvider host.Provider `json:"-"` // 文件下载的 host, domain 可能为 ip, 需要搭配 host 使用 【选填】
DestDir string `json:"-"` // 文件存储目标路径,目前是为了方便用户在批量下载时构建 ToFile 【此处选填】
ToFile string `json:"to_file"` // 文件保存的路径 【必填】
Referer string `json:"referer"` // 请求 header 中的 Referer 【选填】
FileEncoding string `json:"-"` // 文件编码方式 【选填】
ServerFilePutTime int64 `json:"server_file_put_time"` // 文件修改时间 【选填】
ServerFileSize int64 `json:"server_file_size"` // 文件大小,有值则会检测文件大小 【选填】
ServerFileHash string `json:"server_file_hash"` // 文件 hash,有值则会检测 hash 【选填】
FromBytes int64 `json:"-"` // 下载开始的位置,内部会缓存 【内部使用】
RemoveTempWhileError bool `json:"-"` // 当遇到错误时删除临时文件 【选填】
UseGetFileApi bool `json:"-"` // 是否使用 get file api(私有云会使用)【选填】
Progress progress.Progress `json:"-"` // 下载进度回调【选填】
}
type ApiResult ¶
type ApiResult struct {
FileModifyTime int64 // 下载后文件修改时间
FileAbsPath string // 文件被保存的绝对路径
IsUpdate bool // 是否为接续下载
IsExist bool // 是否为已存在
}
type PublicUrlToPrivateApiInfo ¶
PublicUrlToPrivateApiInfo 私有下载链接
type PublicUrlToPrivateApiResult ¶ added in v2.8.0
type PublicUrlToPrivateApiResult struct {
Url string
}
func PublicUrlToPrivate ¶
func PublicUrlToPrivate(info PublicUrlToPrivateApiInfo) (result *PublicUrlToPrivateApiResult, err *data.CodeError)
PublicUrlToPrivate 公转私
func (*PublicUrlToPrivateApiResult) IsValid ¶ added in v2.8.0
func (p *PublicUrlToPrivateApiResult) IsValid() bool
type UrlApiInfo ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.