remote

package
v0.154.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

func IsRemote

func IsRemote(goGetterSrc string) bool

Types

type Getter

type Getter interface {
	Get(wd, src, dst string) error
}

type GoGetter

type GoGetter struct {
	Logger *zap.SugaredLogger
}

func (*GoGetter) Get

func (g *GoGetter) Get(wd, src, dst string) error

type InvalidURLError

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

func (InvalidURLError) Error

func (e InvalidURLError) Error() string

type Remote

type Remote struct {
	Logger *zap.SugaredLogger

	// Home is the directory in which remote downloads files. If empty, user cache directory is used
	Home string

	// Getter is the underlying implementation of getter used for fetching remote files
	Getter Getter
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(logger *zap.SugaredLogger, homeDir string, fs *filesystem.FileSystem) *Remote

func (*Remote) Fetch

func (r *Remote) Fetch(goGetterSrc string, cacheDirOpt ...string) (string, error)

func (*Remote) Locate

func (r *Remote) Locate(urlOrPath string, cacheDirOpt ...string) (string, error)

Locate takes an URL to a remote file or a path to a local file. If the argument was an URL, it fetches the remote directory contained within the URL, and returns the path to the file in the fetched directory

type Source

type Source struct {
	Getter, Scheme, User, Host, Dir, File, RawQuery string
}

func Parse

func Parse(goGetterSrc string) (*Source, error)

Jump to

Keyboard shortcuts

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