extractor

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 13 Imported by: 0

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.

Jump to

Keyboard shortcuts

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