download

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, url string, outPath string, progressCh chan<- any, id string) error

Download is the CLI entry point (non-TUI) - convenience wrapper

func TUIDownload

func TUIDownload(ctx context.Context, cfg *types.DownloadConfig) error

TUIDownload is the main entry point for downloads executed by the Engine pool

Types

type ProbeResult

type ProbeResult struct {
	FileSize      int64
	SupportsRange bool
	Filename      string
	ContentType   string
}

ProbeResult contains all metadata from server probe

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

func NewWorkerPool

func NewWorkerPool(progressCh chan<- any, maxDownloads int) *WorkerPool

func (*WorkerPool) ActiveCount

func (p *WorkerPool) ActiveCount() int

ActiveCount returns the number of currently active (downloading/pausing) downloads

func (*WorkerPool) Add

func (p *WorkerPool) Add(cfg types.DownloadConfig)

Add adds a new download task to the pool

func (*WorkerPool) Cancel

func (p *WorkerPool) Cancel(downloadID string)

Cancel cancels and removes a download by ID

func (*WorkerPool) GetAll

func (p *WorkerPool) GetAll() []types.DownloadConfig

GetAll returns all active download configs (for listing)

func (*WorkerPool) GetStatus

func (p *WorkerPool) GetStatus(id string) *types.DownloadStatus

GetStatus returns the status of an active download

func (*WorkerPool) GracefulShutdown

func (p *WorkerPool) GracefulShutdown()

GracefulShutdown pauses all downloads and waits for them to save state

func (*WorkerPool) HasDownload

func (p *WorkerPool) HasDownload(url string) bool

HasDownload reports whether a download with the given URL is currently active or queued in the pool.

func (*WorkerPool) Pause

func (p *WorkerPool) Pause(downloadID string) bool

Pause pauses a specific download by ID. Returns true if found and pause initiated (or already paused), false otherwise.

func (*WorkerPool) PauseAll

func (p *WorkerPool) PauseAll()

PauseAll pauses all active downloads (for graceful shutdown)

func (*WorkerPool) Resume

func (p *WorkerPool) Resume(downloadID string) bool

Resume resumes a paused download by ID. Returns true if found and resumed (or already running), false otherwise.

func (*WorkerPool) UpdateURL

func (p *WorkerPool) UpdateURL(downloadID string, newURL string) error

UpdateURL updates the URL of a download by ID. It fails if the download is actively downloading (not paused or errored).

Jump to

Keyboard shortcuts

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