download

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultProgressBar getter.ProgressTracker = &ProgressBar{}

DefaultProgressBar is the default instance of a cheggaaa progress bar.

Functions

func ProgressBarConfig

func ProgressBarConfig(bar *pb.ProgressBar, prefix string)

ProgressBarConfig config

Types

type ProgressBar

type ProgressBar struct {
	// contains filtered or unexported fields
}

ProgressBar wraps a github.com/cheggaaa/pb.Pool in order to display download progress for one or multiple downloads.

If two different instance of ProgressBar try to display a progress only one will be displayed. It is therefore recommended to use DefaultProgressBar

func (*ProgressBar) TrackProgress

func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

TrackProgress instantiates a new progress bar that will display the progress of stream until closed. total can be 0.

type Release

type Release struct {
	Account       string
	Name          string
	ArtifactName  string
	LocalFileName string
	Version       string
	URL           string
}

Release represents a github release

func (*Release) DownloadIfNotExists

func (release *Release) DownloadIfNotExists() error

DownloadIfNotExists downloads a github release if its not present in the local config folder

func (*Release) SetArtifactName

func (release *Release) SetArtifactName(artifacts map[string]string) *Release

SetArtifactName returns artifactname given GOOS and GOARCH

func (*Release) SetDownloadURL

func (release *Release) SetDownloadURL() *Release

SetDownloadURL based on if version is latest or tagged

func (*Release) SetVersion

func (release *Release) SetVersion(version string) *Release

SetVersion return version from config file or latest if not specified

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL