getparty

package module
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: BSD-3-Clause Imports: 35 Imported by: 0

README

getparty

Build status Lint status

HTTP Download Manager with multi-parts

showcase

Installation

Homebrew
$ brew tap vbauerster/getparty
$ brew install getparty
Aur
$ paru -S getparty
From source
$ git clone --depth 1 https://github.com/vbauerster/getparty.git
$ cd getparty/cmd/getparty && go build

Usage

Usage:
  getparty [OPTIONS] [<url>]

Application Options:
  -p, --parts=n                                             number of parts (default: 1)
  -r, --max-retry=n                                         max retries per each part, 0 for infinite (default: 10)
      --max-redirect=n                                      max redirections allowed, 0 for infinite (default: 10)
  -t, --timeout=sec                                         context timeout (default: 15)
  -l, --speed-limit=n                                       speed limit gauge, value from 1 to 10 inclusive
  -o, --output=FILE                                         output file name
  -s, --session=FILE                                        session state of incomplete download, file with json extension
  -U, --user-agent=[chrome|firefox|safari|edge|getparty]    User-Agent header (default: chrome)
      --username=                                           basic http auth username
      --password=                                           basic http auth password
  -H, --header=key:value                                    http header, can be specified more than once
  -f, --force                                               overwrite existing file silently
  -q, --quiet                                               quiet mode, no progress bars
  -d, --debug                                               enable debug to stderr
  -v, --version                                             show version

Https Options:
  -c, --certs-file=certs.crt                                root certificates to use when verifying server certificates
      --no-check-cert                                       don't verify the server's certificate chain and host name

Best-mirror Options:
  -m, --mirror.list=FILE|-                                  mirror list input
  -g, --mirror.max=n                                        max concurrent http request (default: number of logical CPUs)
      --mirror.top=n                                        list top n mirrors, download condition n=1 (default: 1)

Help Options:
  -h, --help                                                Show this help message

Arguments:
  <url>:                                                    http location
Best mirror example:

read mirrors.txt from a file and proceed to dowload from the best mirror:

getparty -m mirrors.txt

read mirrors.txt from a stdin and proceed to dowload from the best mirror:

cat mirrors.txt | getparty -m -

just list top 3 mirrors without any download:

getparty -m mirrors.txt --mirror.top 3

License

BSD 3-Clause

Documentation

Index

Constants

View Source
const (
	ErrBadInvariant   = ExpectedError("Bad invariant")
	ErrCanceledByUser = ExpectedError("Canceled by user")
	ErrMaxRedirect    = ExpectedError("Max redirections")
	ErrMaxRetry       = ExpectedError("Max retries")
)
View Source
const (
	DEBUG = iota
	INFO
	WARN
	ERRO
	LEVELS
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BadHttpStatus added in v1.22.0

type BadHttpStatus int

func (BadHttpStatus) Error added in v1.22.0

func (e BadHttpStatus) Error() string

type Cmd

type Cmd struct {
	Ctx context.Context
	Out io.Writer
	Err io.Writer
	// contains filtered or unexported fields
}

func (Cmd) Exit

func (cmd Cmd) Exit(err error) (status int)

func (*Cmd) Run

func (cmd *Cmd) Run(args []string, version, commit string) (err error)

type ExpectedError

type ExpectedError string

func (ExpectedError) Error

func (e ExpectedError) Error() string

type Options

type Options struct {
	Parts          uint              `short:"p" long:"parts" value-name:"n" default:"1" description:"number of parts"`
	MaxRetry       uint              `short:"r" long:"max-retry" value-name:"n" default:"10" description:"max retries per each part, 0 for infinite"`
	MaxRedirect    uint              `long:"max-redirect" value-name:"n" default:"10" description:"max redirections allowed, 0 for infinite"`
	Timeout        uint              `short:"t" long:"timeout" value-name:"sec" default:"15" description:"context timeout"`
	SpeedLimit     uint              `short:"l" long:"speed-limit" value-name:"n" description:"speed limit gauge, value from 1 to 10 inclusive"`
	OutputName     string            `short:"o" long:"output" value-name:"FILE" description:"output file name"`
	SessionName    string            `short:"s" long:"session" value-name:"FILE" description:"session state of incomplete download, file with json extension"`
	UserAgent      string            `` /* 157-byte string literal not displayed */
	AuthUser       string            `long:"username" description:"basic http auth username"`
	AuthPass       string            `long:"password" description:"basic http auth password"`
	HeaderMap      map[string]string `short:"H" long:"header" value-name:"key:value" description:"http header, can be specified more than once"`
	ForceOverwrite bool              `short:"f" long:"force" description:"overwrite existing file silently"`
	Quiet          bool              `short:"q" long:"quiet" description:"quiet mode, no progress bars"`
	Debug          bool              `short:"d" long:"debug" description:"enable debug to stderr"`
	Version        bool              `short:"v" long:"version" description:"show version"`
	Https          struct {
		CertsFileName      string `short:"c" long:"certs-file" value-name:"certs.crt" description:"root certificates to use when verifying server certificates"`
		InsecureSkipVerify bool   `long:"no-check-cert" description:"don't verify the server's certificate chain and host name"`
	} `group:"Https Options"`
	BestMirror struct {
		Mirrors string `short:"m" long:"list" value-name:"FILE|-" description:"mirror list input"`
		MaxGo   uint   `short:"g" long:"max" value-name:"n" description:"max concurrent http request (default: number of logical CPUs)"`
		TopN    uint   `long:"top" value-name:"n" default:"1" description:"list top n mirrors, download condition n=1"`
	} `group:"Best-mirror Options" namespace:"mirror"`
	Positional struct {
		Location string `positional-arg-name:"<url>" description:"http location"`
	} `positional-args:"yes"`
}

Options struct, represents cmd line options

type Part

type Part struct {
	Start   int64
	Stop    int64
	Written int64
	Elapsed time.Duration
	// contains filtered or unexported fields
}

Part represents state of each download part

type Session

type Session struct {
	URL           string
	OutputName    string
	ContentMD5    string
	AcceptRanges  string
	ContentType   string
	StatusCode    int
	ContentLength int64
	Redirected    bool
	Elapsed       time.Duration
	HeaderMap     map[string]string
	Parts         []*Part
	// contains filtered or unexported fields
}

Session represents download session state

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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