download

package
v0.31.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

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(dir string, namesAndSources map[string]string) (map[string]io.ReadCloser, 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

Jump to

Keyboard shortcuts

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