Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SourceKind go安装包种类-源码 SourceKind = "Source" // ArchiveKind go安装包种类-压缩文件 ArchiveKind = "Archive" // InstallerKind go安装包种类-可安装程序 InstallerKind = "Installer" )
Variables ¶
View Source
var ( // ErrUnsupportedChecksumAlgorithm 不支持的校验和算法 ErrUnsupportedChecksumAlgorithm = errors.New("unsupported checksum algorithm") // ErrChecksumNotMatched 校验和不匹配 ErrChecksumNotMatched = errors.New("file checksum does not match the computed checksum") )
View Source
var ErrPackageNotFound = errors.New("installation package not found")
ErrPackageNotFound 版本包不存在
View Source
var ErrVersionNotFound = errors.New("version not found")
ErrVersionNotFound 版本不存在
Functions ¶
func DownloadFile ¶
DownloadFile will download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory. We pass an io.TeeReader into Copy() to report progress on the download.
func NewDownloadError ¶
NewDownloadError 返回下载失败错误实例
func PathExists ¶
PathExists 判断一个文件或文件夹是否存在 输入文件路径,根据返回的bool值来判断文件或文件夹是否存在
Types ¶
type DownloadError ¶
type DownloadError struct {
// contains filtered or unexported fields
}
DownloadError 下载失败错误
func (*DownloadError) Error ¶
func (e *DownloadError) Error() string
type FindPackageInterface ¶
type Package ¶
type Package struct {
FileName string
ArchiveName string
URL string
Kind string
OS string
Arch string
Size string
Checksum string
Algorithm string // checksum algorithm
}
Package 版本安装包
func (*Package) DownloadV2 ¶
DownloadV2 下载版本另存为指定文件并校验sha256哈希值
func (*Package) VerifyChecksum ¶
VerifyChecksum 验证目标文件的校验和与当前安装包的校验和是否一致
Click to show internal directories.
Click to hide internal directories.