util

package
v0.1.50 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: GPL-2.0 Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadUrlToTempFile

func DownloadUrlToTempFile(url string) (string, error)

func ExtractGithubOwnerRepo

func ExtractGithubOwnerRepo(githubURL string) (string, string, error)

ExtractGithubOwnerRepo extracts the organization and repository from a GitHub URL.

func FindAppImageLink(pageURL string) (string, error)

FindAppImageLink returns the latest AppImage link discovered on the page.

func SaveReaderToTempFile

func SaveReaderToTempFile(reader io.Reader) (string, error)

func StringOrDefault

func StringOrDefault(description *string, defaultStr string) string

func TrimSuffixes

func TrimSuffixes(s string, suffixes ...string) string

TrimSuffixes removes the first matching suffix from the input string.

Types

type AppImage

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

func NewAppImage

func NewAppImage(path string) (*AppImage, error)

func (*AppImage) Close

func (ai *AppImage) Close() error

func (*AppImage) ListFiles

func (ai *AppImage) ListFiles(targetDir string) []string
type AppImageLink struct {
	// Href is the raw attribute value as seen in the HTML.
	Href string
	// URL is the fully resolved absolute URL that can be downloaded. When
	// redirects are encountered this will contain the final destination.
	URL string
	// Filename is the last path element of the resolved URL.
	Filename string
}

AppImageLink represents a discovered AppImage hyperlink.

func FindAppImageLinks(pageURL, matchExpr string) ([]AppImageLink, error)

FindAppImageLinks returns all AppImage links on the provided page sorted in version-aware order. When matchExpr is provided it is treated as a case insensitive regular expression applied to the raw href attribute.

func FindAppImageLinksWithExtension

func FindAppImageLinksWithExtension(pageURL, matchExpr, extension string) ([]AppImageLink, error)

FindAppImageLinksWithExtension behaves like FindAppImageLinks but allows callers to override the file extension matched on the source page.

type FileSystem added in v0.1.27

type FileSystem interface {
	ReadFile(name string) ([]byte, error)
	MkdirAll(path string, perm os.FileMode) error
	WriteFile(name string, data []byte, perm os.FileMode) error
	Remove(name string) error
	Lstat(name string) (os.FileInfo, error)
	Chmod(name string, mode os.FileMode) error
}

type MockFS added in v0.1.27

type MockFS struct {
	Files map[string][]byte
	Modes map[string]fs.FileMode
	Dirs  map[string]bool
}

func NewMockFS added in v0.1.27

func NewMockFS() *MockFS

func (*MockFS) Chmod added in v0.1.47

func (m *MockFS) Chmod(name string, mode os.FileMode) error

func (*MockFS) Lstat added in v0.1.47

func (m *MockFS) Lstat(name string) (os.FileInfo, error)

func (*MockFS) MkdirAll added in v0.1.27

func (m *MockFS) MkdirAll(path string, perm fs.FileMode) error

func (*MockFS) ReadFile added in v0.1.27

func (m *MockFS) ReadFile(name string) ([]byte, error)

func (*MockFS) Remove added in v0.1.47

func (m *MockFS) Remove(name string) error

func (*MockFS) WriteFile added in v0.1.27

func (m *MockFS) WriteFile(name string, data []byte, perm fs.FileMode) error

type OSFS added in v0.1.27

type OSFS struct{}

func (OSFS) Chmod added in v0.1.47

func (OSFS) Chmod(name string, mode os.FileMode) error

func (OSFS) Lstat added in v0.1.47

func (OSFS) Lstat(name string) (os.FileInfo, error)

func (OSFS) MkdirAll added in v0.1.27

func (OSFS) MkdirAll(path string, perm os.FileMode) error

func (OSFS) ReadFile added in v0.1.27

func (OSFS) ReadFile(name string) ([]byte, error)

func (OSFS) Remove added in v0.1.47

func (OSFS) Remove(name string) error

func (OSFS) WriteFile added in v0.1.27

func (OSFS) WriteFile(name string, data []byte, perm os.FileMode) error

type ReaderCloser

type ReaderCloser struct {
	Closer func() error
	io.Reader
}

func (*ReaderCloser) Close

func (oc *ReaderCloser) Close() error

Jump to

Keyboard shortcuts

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