Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadAndExtractWorlds ¶
func DownloadAndExtractWorlds(downloadURL, outputDir string, worlds []string, opts DownloadOptions) error
DownloadAndExtractWorlds downloads a backup from the given URL and extracts only the specified world directories into outputDir.
opts.Mode selects the download strategy:
- "auto" — probe the server; use parallel if it supports Range requests and the file is ≥ 64 MB, otherwise stream directly (no temp file).
- "parallel" — force parallel download; returns an error if the server does not support Range requests or does not report Content-Length.
- "single" — force a single HTTP connection and stream the response body directly into the tar reader without writing a temp file to disk.
opts.Connections overrides the automatic connection count when > 0.
The backup is expected to be a tar.gz archive. World folders are matched by checking if a tar entry path starts with one of the world names (e.g. "world/", "world_nether/").
Types ¶
type DownloadOptions ¶ added in v1.3.2
type DownloadOptions struct {
Mode string // "auto", "parallel", "single"
Connections int // 0 = auto (size-based scaling), >0 = manual override (1-32)
}
DownloadOptions configures the download behavior.
Click to show internal directories.
Click to hide internal directories.