download

package
v0.50.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashKey = "hash:sha256"
)

Variables

View Source
var (
	HTTPClient = &http.Client{
		Timeout: 45 * time.Second,
	}
)

Functions

This section is empty.

Types

type Downloader

type Downloader struct {
	HTTP   *http.Client
	Logger log.Logger
}

Downloader will download and cache DPL files in a temp directory.

If HTTP is nil then http.DefaultClient will be used (which has NO timeouts).

See: https://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/sdn_data.aspx

func New

func New(logger log.Logger, httpClient *http.Client) *Downloader

func (*Downloader) GetFiles

func (dl *Downloader) GetFiles(ctx context.Context, dir string, namesAndSources map[string]string) (Files, error)

GetFiles will initiate download of all provided files, return an io.ReadCloser to their content

initialDir is an optional filepath to look for files in before attempting to download.

Callers are expected to call the io.Closer interface method when they are done with the file

type Files added in v0.50.0

type Files map[string]io.ReadCloser

func (Files) Close added in v0.50.0

func (fs Files) Close() error

Jump to

Keyboard shortcuts

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