Documentation
¶
Overview ¶
Package ghrelease reads GitHub releases and downloads their assets with checksum verification. It is shared by self-update and extensions.
Index ¶
- Variables
- func FileSHA256(path string) (string, error)
- func ParseChecksums(b []byte) map[string]string
- type Asset
- type Client
- func (c *Client) Checksums(ctx context.Context, a *Asset) (map[string]string, error)
- func (c *Client) Download(ctx context.Context, a *Asset, w io.Writer) (string, error)
- func (c *Client) Latest(ctx context.Context, repo string) (*Release, error)
- func (c *Client) Tag(ctx context.Context, repo, tag string) (*Release, error)
- type Release
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("release not found")
Functions ¶
func ParseChecksums ¶
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
APIBase string
UserAgent string
// Token is an optional GitHub token (GH_TOKEN / GITHUB_TOKEN) to raise rate limits.
Token string
}
func (*Client) Checksums ¶
Checksums downloads and parses a checksums file ("<sha256> <name>" lines).
func (*Client) Download ¶
Download streams an asset into w and returns its SHA-256 (hex). Tokens are never sent to download hosts.