download

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPClient = &http.Client{
		Timeout: 15 * 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(initialDir string, namesAndSources map[string]string) ([]string, error)

GetFiles will download all provided files, return their filepaths, and store them in a temporary directory and an error otherwise.

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

Callers are expected to cleanup the temp directory.

Jump to

Keyboard shortcuts

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