util

package
v2.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadData

func DownloadData(ctx context.Context, u *url.URL, decomp Decompressor, c *Cache) error

func NewColoredLogWriter

func NewColoredLogWriter(kind, name string, writer io.Writer) *coloredLogWriter

func WriteToFile

func WriteToFile(srcPath, destPath string, decomp Decompressor) error

writeToFile copies contents of file at srcPath to destPath, optionally decompressing the source contents if decomp is not nil.

Types

type Cache

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

func NewCache

func NewCache(dir string) *Cache

func (*Cache) Contains

func (c *Cache) Contains(key string) bool

func (*Cache) Get

func (c *Cache) Get(key string) (io.ReadCloser, error)

func (*Cache) Path

func (c *Cache) Path(key string) string

func (*Cache) Put

func (c *Cache) Put(key string, data io.Reader) error

type Decompressor

type Decompressor interface {
	Decompress(io.Reader) (io.Reader, error)
}

Decompressor defines an interface to decompress data from io.Reader.

func NewDecompressor

func NewDecompressor(format string) (Decompressor, error)

NewDecompressor returns a Decompressor for "format". If format is not supported, this returns a non-nil error.

Jump to

Keyboard shortcuts

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