util

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 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 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