Documentation
¶
Index ¶
- func DownloadHTTP(ctx context.Context, a *Asset, url, downloadsDir, filename string, ...) error
- type Asset
- func (a *Asset) Classify(name string) Type
- func (a *Asset) Cleanup() error
- func (a *Asset) Download(_ context.Context) error
- func (a *Asset) Extract() error
- func (a *Asset) GetAsset() *Asset
- func (a *Asset) GetBaseName() string
- func (a *Asset) GetChecksumType() string
- func (a *Asset) GetDisplayName() string
- func (a *Asset) GetFilePath() string
- func (a *Asset) GetFiles() []*File
- func (a *Asset) GetGPGKeyID() (uint64, error)
- func (a *Asset) GetMatchedAsset() IAsset
- func (a *Asset) GetName() string
- func (a *Asset) GetParentType() Type
- func (a *Asset) GetTempPath() string
- func (a *Asset) GetType() Type
- func (a *Asset) ID() string
- func (a *Asset) Install(id, binDir, optDir string) error
- func (a *Asset) Path() string
- func (a *Asset) SetMatchedAsset(asset IAsset)
- type File
- type IAsset
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadHTTP ¶ added in v1.10.0
func DownloadHTTP(ctx context.Context, a *Asset, url, downloadsDir, filename string, logger *zerolog.Logger, beforeRequest func(*http.Request)) error
DownloadHTTP downloads a file from a URL, caching by sha256 hash file. It sets DownloadPath, Extension, and Hash on the provided Asset. beforeRequest allows callers to add custom headers (auth tokens, etc).
Types ¶
type Asset ¶
type Asset struct {
Name string
DisplayName string
Type Type
ParentType Type
ChecksumType string
MatchedAsset IAsset
OS string
Arch string
Version string
Extension string
DownloadPath string
Hash string
TempDir string
Files []*File
}
func (*Asset) GetBaseName ¶ added in v1.3.0
func (*Asset) GetChecksumType ¶
func (*Asset) GetDisplayName ¶
func (*Asset) GetFilePath ¶
func (*Asset) GetGPGKeyID ¶
func (*Asset) GetMatchedAsset ¶
func (*Asset) GetParentType ¶
func (*Asset) GetTempPath ¶
func (*Asset) SetMatchedAsset ¶
type IAsset ¶
type IAsset interface {
GetName() string
GetDisplayName() string
GetType() Type
GetParentType() Type
GetAsset() *Asset
GetFiles() []*File
GetTempPath() string
GetFilePath() string
Download(context.Context) error
Extract() error
Install(string, string, string) error
Cleanup() error
ID() string
Path() string
GetChecksumType() string
GetMatchedAsset() IAsset
SetMatchedAsset(IAsset)
GetGPGKeyID() (uint64, error)
GetBaseName() string
}
Click to show internal directories.
Click to hide internal directories.