util

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: GPL-2.0 Imports: 17 Imported by: 0

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
}

type MockFS added in v0.1.27

type MockFS struct {
	Files map[string][]byte
}

func NewMockFS added in v0.1.27

func NewMockFS() *MockFS

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) 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) 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) 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