getparty

package module
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: BSD-3-Clause Imports: 32 Imported by: 0

README

getparty

Build status

HTTP Download Manager with multi-parts

showcase

Installation

Homebrew
$ brew tap vbauerster/getparty
$ brew install getparty
Manual
$ go get -u github.com/vbauerster/getparty
$ cd $GOPATH/src/github.com/vbauerster/getparty/cmd/getparty
$ go install

Usage

Usage:
  getparty [OPTIONS] url

Application Options:
  -p, --parts=n                                             number of parts (default: 1)
  -r, --max-retry=n                                         max retry per each part, 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=filename                                     user defined output
  -s, --session=session.json                                path to saved session file (optional)
  -a, --user-agent=[chrome|firefox|safari|edge|getparty]    User-Agent header (default: chrome)
  -b, --best-mirror                                         pickup the fastest mirror
  -q, --quiet                                               quiet mode, no progress bars
  -f, --force                                               overwrite existing file silently
  -u, --username=                                           basic http auth username
      --password=                                           basic http auth password
  -H, --header=key:value                                    http header, can be specified more than once
      --no-check-cert                                       don't validate the server's certificate
  -c, --certs-file=certs.crt                                root certificates to use when verifying server certificates
      --debug                                               enable debug to stderr
  -v, --version                                             show version

Help Options:
  -h, --help                                                Show this help message
Best mirror example:

cat mirrors.txt | getparty -p 8 -b

License

BSD 3-Clause

Documentation

Index

Constants

View Source
const (
	ErrCanceledByUser = ExpectedError("Canceled by user")
	ErrMaxRedirect    = ExpectedError("Max redirects")
	ErrMaxRetry       = ExpectedError("Max retries")
)

Variables

This section is empty.

Functions

This section is empty.

Types

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) 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 HttpError added in v1.11.0

type HttpError int

func (HttpError) Error added in v1.11.0

func (e HttpError) 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 retry per each part, 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"`
	OutFileName        string            `short:"o" long:"output" value-name:"filename" description:"user defined output"`
	JSONFileName       string            `short:"s" long:"session" value-name:"session.json" description:"path to saved session file (optional)"`
	UserAgent          string            `` /* 158-byte string literal not displayed */
	BestMirror         bool              `short:"b" long:"best-mirror" description:"pickup the fastest mirror"`
	Quiet              bool              `short:"q" long:"quiet" description:"quiet mode, no progress bars"`
	ForceOverwrite     bool              `short:"f" long:"force" description:"overwrite existing file silently"`
	AuthUser           string            `short:"u" 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"`
	InsecureSkipVerify bool              `long:"no-check-cert" description:"don't validate the server's certificate"`
	CertsFileName      string            `short:"c" long:"certs-file" value-name:"certs.crt" description:"root certificates to use when verifying server certificates"`
	Debug              bool              `long:"debug" description:"enable debug to stderr"`
	Version            bool              `short:"v" long:"version" description:"show version"`
}

Options struct, represents cmd line options

type Part

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

Part represents state of each download part

type Session

type Session struct {
	URL            string
	OutputFileName 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