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 // 文件所在 bucket 【必填】
Key string // 文件被保存的 key 【必填】
IsPublic bool // 是否使用共有链接 【必填】
HostProvider host.Provider // 文件下载的 host, domain 可能为 ip, 需要搭配 host 使用 【选填】
ToFile string // 文件保存的路径 【必填】
StatusDBPath string // 下载状态缓存的 db 路径 【选填】
Referer string // 请求 header 中的 Referer 【选填】
FileEncoding string // 文件编码方式 【选填】
FileModifyTime int64 // 文件修改时间 【选填】
FileSize int64 // 文件大小,有值则会检测文件大小 【选填】
FileHash string // 文件 hash,有值则会检测 hash 【选填】
FromBytes int64 // 下载开始的位置,内部会缓存 【内部使用】
RemoveTempWhileError bool // 当遇到错误时删除临时文件 【选填】
UseGetFileApi bool // 是否使用 get file api(私有云会使用)【选填】
Progress progress.Progress // 下载进度回调【选填】
}
type ApiResult ¶
type ApiResult struct {
FileAbsPath string // 文件被保存的绝对路径
IsUpdate bool // 是否为接续下载
IsExist bool // 是否为已存在
}
type LocalFileInfo ¶
type LocalFileInfo struct {
File string // 被检测的文件 【必填】
Bucket string // 文件所在 bucket 用于检查 hash【选填】
Key string // 文件被保存的 key 用于检查 hash【选填】
FileHash string // 文件 hash,有值则会检测 hash【选填】
FileSize int64 // 文件大小,有值则会检测文件大小【选填】
RemoveFileWhenError bool // 当遇到错误时是否该移除文件【选填】
}
func (*LocalFileInfo) CheckDownloadFile ¶
func (l *LocalFileInfo) CheckDownloadFile() (err *data.CodeError)
func (*LocalFileInfo) CheckFileHashOfDownloadFile ¶
func (l *LocalFileInfo) CheckFileHashOfDownloadFile() *data.CodeError
func (*LocalFileInfo) CheckFileSizeOfDownloadFile ¶
func (l *LocalFileInfo) CheckFileSizeOfDownloadFile() *data.CodeError
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.