Categorygithub.com/blacktop/go-download
modulepackage
0.0.0-20240609061025-e2140031df05
Repository: https://github.com/blacktop/go-download.git
Documentation: pkg.go.dev

# README

go-download

Go Go Reference License

Golang download manager package.


Install

$ go get github.com/blacktop/go-download

Getting Started

package main

import (
    "context"
    "log/slog"
    "os"
    "os/signal"
    "syscall"    

    "github.com/blacktop/go-download"
)

func main() {
    ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
    defer stop()

    log := slog.NewJSONHandler(os.Stdout, nil)

    mgr, err := download.New(&download.Config{
        Context:  ctx,
        Logger:   log,
        Progress: true,
        Parts:    4,
    })
    if err != nil {
        log.Error(err.Error())
        os.Exit(1)
    }

    if err := mgr.Get(os.Args[1]); err != nil {
        log.Error(err.Error())
        os.Exit(1)
    }
}

License

MIT Copyright (c) 2024 blacktop

# Functions

No description provided by the author
DefaultPooledTransport returns a new http.Transport with similar default values to http.DefaultTransport.
DefaultTransport returns a new http.Transport with similar default values to http.DefaultTransport, but with idle connections and keepalives disabled.
GetProxy takes either an input string or read the enviornment and returns a proxy function.
No description provided by the author
No description provided by the author
No description provided by the author
Retry will retry a function f a number of attempts with a sleep duration in between.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author