fetch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 21 Imported by: 0 modules, 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

Overview

Package fetch downloads server files: plain archives over HTTPS, and Steam apps through SteamCMD.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, url, want, cacheDir string, log Progress) (string, error)

Download fetches url into the cache directory and returns the file path. If want (a sha256 hex string) is set, the file must match it, and a cached file that already matches is reused without downloading.

func Extract

func Extract(archive, subdir, dest string) (int, error)

Extract unpacks the part of an archive under subdir into dest. Paths in the archive that would land outside dest are rejected. Existing files are replaced, and files not in the archive are left alone, so saves survive.

func ExtractAs

func ExtractAs(archive, format, subdir, dest string, keep []string) (int, error)

ExtractAs is Extract for an archive whose type is given as format (zip, tar.gz or tar.xz) instead of read from its file name. An empty format means use the file name. Files listed in keep (paths relative to dest) aren't replaced if they already exist, so config files the archive ships with don't overwrite the user's.

Types

type App

type App struct {
	ID  int
	Dir string
	// Platform optionally forces another OS's build (linux, windows, macos).
	Platform string
	// Beta is an optional beta branch.
	Beta string
	// User logs in with a cached Steam session instead of anonymously.
	User string
}

App describes one SteamCMD app install.

type Progress

type Progress func(format string, a ...any)

Progress receives human-readable status lines.

type SteamCMD

type SteamCMD struct {
	Dir   string
	Cache string
	Log   Progress
	// Output receives SteamCMD's own output. Nil discards it.
	Output io.Writer
}

SteamCMD manages a private copy of SteamCMD.

func (SteamCMD) AppUpdate

func (s SteamCMD) AppUpdate(ctx context.Context, app App) error

AppUpdate installs or updates a Steam app.

func (SteamCMD) Dir32

func (s SteamCMD) Dir32() string

Dir32 and Dir64 hold SteamCMD's own steamclient libraries.

func (SteamCMD) Dir64

func (s SteamCMD) Dir64() string

func (SteamCMD) Ensure

func (s SteamCMD) Ensure(ctx context.Context) (string, error)

Ensure installs SteamCMD if needed and returns its executable path.

func (SteamCMD) Login

func (s SteamCMD) Login(ctx context.Context, user string) error

Login signs in to Steam interactively so SteamCMD caches the session. SteamCMD asks for the password and any Steam Guard code itself, so Anyserve never sees or stores them.

Jump to

Keyboard shortcuts

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