download

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(url string) ([]byte, error)

Get downloads a url and returns the body Timeout is 10 seconds Will only write to disk if http status code is 2XX

func IfNeeded

func IfNeeded(ctx context.Context, absFile string, url string, hash string) bool

IfNeeded takes the same values as Download plus a hash as a string It will check if the file already exists, by comparing the hash If the hash does not match, it will attempt to download the file Once downloaded it will attempt to verify the hash again Cancelling ctx aborts a download in progress, and IfNeeded returns false.

func SetConfig

func SetConfig(cfg config.Configuration)

SetConfig accepts a configuration struct that all functions in the `download` package will use

func Verify

func Verify(file string, sha string) bool

Verify compares a provided hash to the actual hash of a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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