osf

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CacheMaxAge = 7 * 24 * time.Hour

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Project   string
	ProjectID string
	Filename  string
	URL       string
	MD5       string
	SizeMB    float64
}

type Index

type Index struct {
	Entries []Entry
}

func FetchIndex

func FetchIndex(cacheDir string, force bool) (*Index, error)

FetchIndex returns a parsed index, using a cached copy if fresh enough. Set force=true to always re-download.

func ParseIndex

func ParseIndex(r io.Reader) (*Index, error)

ParseIndex reads the TSV index from r. Expected columns: project, project_id, filename, url, md5, size(MB)

func (*Index) Filter

func (idx *Index) Filter(project, pattern string) ([]Entry, error)

Filter returns entries matching the given criteria. If project is non-empty, only entries whose Project starts with that prefix are included. If pattern is non-empty, it is compiled as a regex and matched against "project/filename".

func (*Index) MatchProject

func (idx *Index) MatchProject(query string) []Entry

MatchProject returns entries whose project matches a case-insensitive substring.

func (*Index) Projects

func (idx *Index) Projects() []ProjectSummary

Projects returns a summary of each unique project with file count and total size.

type ProjectSummary

type ProjectSummary struct {
	Project   string
	FileCount int
	TotalMB   float64
}

Jump to

Keyboard shortcuts

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