file

package
v0.21.1-0...-a3b014d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonArchiveSource = fmt.Errorf("non-archive sources are not supported for directory destinations")
)

Functions

func ContentDigest

func ContentDigest(fs afero.Fs, path string, hasher hash.Hash) (string, error)

func Exists

func Exists(fs afero.Fs, path string) bool

func HTTPClientWithCerts

func HTTPClientWithCerts(fileSystem fs.FS, caCertPath string) (*http.Client, error)

func ValidateDigest

func ValidateDigest(path, expectedDigest string, hasher hash.Hash) error

Types

type Getter

type Getter interface {
	// GetFile downloads the give URL into the given path. The URL must reference a single file.
	GetFile(dst, src string, monitor ...*progress.Manual) error

	// GetToDir downloads the resource found at the `src` URL into the given `dst` directory.
	// The directory must already exist, and the remote resource MUST BE AN ARCHIVE (e.g. `.tar.gz`).
	GetToDir(dst, src string, monitor ...*progress.Manual) error
}

func NewDefaultGetter

func NewDefaultGetter() Getter

func NewGetter

func NewGetter(httpClient *http.Client) Getter

NewGetter creates and returns a new Getter. Providing an http.Client is optional. If one is provided, it will be used for all HTTP(S) getting; otherwise, go-getter's default getters will be used.

Jump to

Keyboard shortcuts

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