internal

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NoFileMode = os.FileMode(0)

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)
View Source
var COMMENT_PREFIX = "//"
View Source
var RecommendedAlgo = "sha256"

Functions

func GetUrlToDir added in v0.1.2

func GetUrlToDir(u string, targetDir string, ctx context.Context) (string, error)

GetUrlToDir downloads the given resource to the given directory and returns the path to it.

func GetUrltoTempFile added in v0.1.2

func GetUrltoTempFile(u string, ctx context.Context) (string, error)

GetUrlWithDir downloads the given resource to a temporary file and returns the path to it.

Types

type Hash

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

func NewHash

func NewHash(algo string) (*Hash, error)

type Hasher

type Hasher func() hash.Hash

type Lock

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

Lock represents a grabit lockfile.

func NewLock

func NewLock(path string, newOk bool) (*Lock, error)

func (*Lock) AddResource

func (l *Lock) AddResource(paths []string, algo string, tags []string, filename string) error

func (*Lock) Contains

func (l *Lock) Contains(url string) bool

Contains returns true if this lock file contains the given resource url.

func (*Lock) DeleteResource

func (l *Lock) DeleteResource(path string)

func (*Lock) Download

func (l *Lock) Download(dir string, tags []string, notags []string, perm string) error

Download gets all the resources in this lock file and moves them to the destination directory.

func (*Lock) Save

func (l *Lock) Save() error

Save this lock file to disk.

type Resource

type Resource struct {
	Urls      []string
	Integrity string
	Tags      []string `toml:",omitempty"`
	Filename  string   `toml:",omitempty"`
}

Resource represents an external resource to be downloaded.

func NewResourceFromUrl

func NewResourceFromUrl(urls []string, algo string, tags []string, filename string) (*Resource, error)

func (*Resource) Contains

func (l *Resource) Contains(url string) bool

func (*Resource) Download

func (l *Resource) Download(dir string, mode os.FileMode, ctx context.Context) error

Jump to

Keyboard shortcuts

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