file

package
v0.86.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 21 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 CopyDir

func CopyDir(fs afero.Fs, src string, dst string) error

func CopyFile

func CopyFile(fs afero.Fs, src, dst string) error

func Exists

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

func HashFile

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

func HashReader added in v0.85.0

func HashReader(reader io.Reader, hasher hash.Hash) (string, error)

func ValidateByHash

func ValidateByHash(fs afero.Fs, path, hashStr string) (bool, string, 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
}

type HashiGoGetter

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

func NewGetter

func NewGetter(id clio.Identification, httpClient *http.Client) *HashiGoGetter

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.

func (HashiGoGetter) GetFile

func (g HashiGoGetter) GetFile(dst, src string, monitors ...*progress.Manual) error

func (HashiGoGetter) GetToDir

func (g HashiGoGetter) GetToDir(dst, src string, monitors ...*progress.Manual) error

Jump to

Keyboard shortcuts

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