utils

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadWithChecksum

func DownloadWithChecksum(ctx context.Context, d types.Downloader, url, expectedChecksum string) ([]byte, error)

DownloadWithChecksum downloads a file and verifies its checksum

func GetExtractor

func GetExtractor(filename string) (types.Extractor, error)

GetExtractor returns the appropriate extractor based on file extension

Types

type DefaultDownloader

type DefaultDownloader struct {
	Client *http.Client
}

DefaultDownloader implements the Downloader interface using HTTP

func NewDefaultDownloader

func NewDefaultDownloader() *DefaultDownloader

NewDefaultDownloader creates a new HTTP downloader

func (*DefaultDownloader) Download

func (d *DefaultDownloader) Download(ctx context.Context, url string, writer io.Writer) error

Download downloads a file from the given URL

type TarGzExtractor

type TarGzExtractor struct{}

TarGzExtractor extracts tar.gz archives

func (*TarGzExtractor) Extract

func (e *TarGzExtractor) Extract(src, dest string) error

Extract extracts a tar.gz archive

type ZipExtractor

type ZipExtractor struct{}

ZipExtractor extracts zip archives

func (*ZipExtractor) Extract

func (e *ZipExtractor) Extract(src, dest string) error

Extract extracts a zip archive

Jump to

Keyboard shortcuts

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