Documentation
¶
Overview ¶
Package artifact contains utilities for working downloading files.
Index ¶
- func CanGetS3Object(log log.T, amazonS3URL s3util.AmazonS3URL) bool
- func FileCopy(log log.T, destinationPath string, src io.Reader) (written int64, err error)
- func ListS3Directory(log log.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
- func ListS3Folders(log log.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
- func Md5HashValue(log log.T, filePath string) (hash string, err error)
- func Sha256HashValue(log log.T, filePath string) (hash string, err error)
- func VerifyHash(log log.T, input DownloadInput, output DownloadOutput) (bool, error)
- type DownloadInput
- type DownloadOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanGetS3Object ¶
func CanGetS3Object(log log.T, amazonS3URL s3util.AmazonS3URL) bool
CanGetS3Object returns true if it is possible to fetch an object because it exists, is not deleted, and read permissions exist for this request
func ListS3Directory ¶
ListS3Directory returns all the objects (files and folders) under a given S3 URL where folders are keys whose prefix is the URL key and contain a / after the prefix.
func ListS3Folders ¶
ListS3Folders returns the folders under a given S3 URL where folders are keys whose prefix is the URL key and contain a / after the prefix. The folder name is the part between the prefix and the /.
func Md5HashValue ¶
Md5HashValue gets the md5 hash value
func Sha256HashValue ¶
Sha256HashValue gets the sha256 hash value
func VerifyHash ¶
func VerifyHash(log log.T, input DownloadInput, output DownloadOutput) (bool, error)
VerifyHash verifies the hash of the url file as per specified hash algorithm type and its value
Types ¶
type DownloadInput ¶
type DownloadInput struct { SourceURL string DestinationDirectory string SourceChecksums map[string]string }
DownloadInput specifies the input to file download operation
type DownloadOutput ¶
DownloadOutput holds the result of file download operation.
func Download ¶
func Download(log log.T, input DownloadInput) (output DownloadOutput, err error)
Download is a generic utility which attempts to download smartly.