fetch

package
v0.0.63-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, url string, options ...Option) ([]byte, error)

Download fetches the content at url, validates the Content-Type is a YAML variant, and returns the raw bytes.

Types

type NopObserver

type NopObserver struct{}

NopObserver is a no-op ProgressObserver. Use it instead of nil to avoid nil checks throughout the call chain.

func (NopObserver) Start

type NopTracker

type NopTracker struct{}

NopTracker is a no-op ProgressTracker returned by NopObserver.

func (NopTracker) Add

func (NopTracker) Add(int64)

func (NopTracker) Done

func (NopTracker) Done(error)

type Option

type Option func(*downloadOptions)

func WithProgress

func WithProgress(kind SourceKind, progress ProgressObserver) Option

type ProgressInfo

type ProgressInfo struct {
	Kind       SourceKind
	URL        string
	TotalBytes int64
}

type ProgressObserver

type ProgressObserver interface {
	Start(info ProgressInfo) ProgressTracker
}

type ProgressTracker

type ProgressTracker interface {
	Add(n int64)
	Done(err error)
}

type SourceKind

type SourceKind string
const (
	SourceRemoteConfig SourceKind = "remote config"
	SourceRemoteMixin  SourceKind = "remote mixin"
	SourceSelfUpdate   SourceKind = "self update"
)

Jump to

Keyboard shortcuts

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