asset

package
v0.0.0-...-eb2ba85 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

Fetcher can retrieve assets from various sources. It works by delegating to a handler for the scheme of the source URI.

func NewDefaultFetcher

func NewDefaultFetcher() *Fetcher

NewDefaultFetcher creates a new fetcher with default handlers.

func NewFetcher

func NewFetcher(handlers map[string]handler) *Fetcher

NewFetcher creates a new fetcher.

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(ctx context.Context, sourceURI, destination, integrity string) (changed bool, retErr error)

Fetch retrieves a file from a source URI.

func (*Fetcher) FetchUnchecked

func (f *Fetcher) FetchUnchecked(ctx context.Context, sourceURI, destination string) (changed bool, retErr error)

FetchUnchecked retrieves a file from a source URI without verifying its integrity.

type FileFetcher

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

FileFetcher is a Fetcher that retrieves assets from a file. It handles the "file" scheme.

func NewFileFetcher

func NewFileFetcher() *FileFetcher

NewFileFetcher creates a new file fetcher.

func (*FileFetcher) Fetch

func (f *FileFetcher) Fetch(_ context.Context, uri *url.URL, destination string, expectedSum []byte, hasher hash.Hash) (bool, error)

Fetch retrieves a file from the local filesystem.

func (*FileFetcher) FetchUnchecked

func (f *FileFetcher) FetchUnchecked(_ context.Context, uri *url.URL, destination string) (bool, error)

FetchUnchecked retrieves a file from the local filesystem without verifying its integrity.

type HTTPFetcher

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

HTTPFetcher is a Fetcher that retrieves assets from http(s). It handles the "http" and "https" schemes.

func NewHTTPFetcher

func NewHTTPFetcher() *HTTPFetcher

NewHTTPFetcher creates a new HTTP fetcher.

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(ctx context.Context, uri *url.URL, destination string, expectedSum []byte, hasher hash.Hash) (bool, error)

Fetch retrieves a file from an HTTP server.

func (*HTTPFetcher) FetchUnchecked

func (f *HTTPFetcher) FetchUnchecked(ctx context.Context, uri *url.URL, destination string) (bool, error)

FetchUnchecked retrieves a file from an HTTP server without verifying its integrity.

Jump to

Keyboard shortcuts

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