helper

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidNarURL is returned if the regexp did not match the given URL.
	ErrInvalidNarURL = errors.New("invalid nar URL")
)
View Source
var ErrInvalidSizeSuffix = errors.New("invalid size suffix")

ErrInvalidSizeSuffix is returned if the suffix is not valid.

Functions

func MustRandString added in v0.0.11

func MustRandString(n int, r io.Reader) string

MustRandString returns the string returned by RandString. If RandString returns an error, it will panic.

func NarInfoPath

func NarInfoPath(hash string) string

NarInfoPath returns the path of the narinfo file given a hash.

func NarPath

func NarPath(hash, compression string) string

NarPath returns the path of the nar file given a hash and an optional compression.

func ParseNarURL added in v0.0.2

func ParseNarURL(URL string) (string, string, error)

ParseNarURL parses a nar URL (as present in narinfo) and returns its components.

func ParseSize added in v0.0.11

func ParseSize(str string) (uint64, error)

ParseSize parses size with units and returns the same size in bytes.

func RandString added in v0.0.4

func RandString(n int, r io.Reader) (string, error)

RandString returns a random string of length n using r as the random reader; If r is nil, rand.Reader will be used instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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