Documentation ¶
Overview ¶
Package artifact contains utilities for working downloading files.
Index ¶
- func CanGetS3Object(context context.T, amazonS3URL s3util.AmazonS3URL) bool
- func FileCopy(log log.T, destinationPath string, src io.Reader) (written int64, err error)
- func ListS3Directory(context context.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
- func ListS3Folders(context context.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
- func Md5HashValue(log log.T, filePath string) (hash string, err error)
- func S3FileRead(context context.T, s3FullPath string) (output []byte, 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(context context.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 ¶
func ListS3Directory(context context.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
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 ¶
func ListS3Folders(context context.T, amazonS3URL s3util.AmazonS3URL) (folderNames []string, err error)
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 S3FileRead ¶
S3FileRead attempts to read a file content from S3 via s3 client.
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 ExpectedBucketOwner string }
DownloadInput specifies the input to file download operation
type DownloadOutput ¶
DownloadOutput holds the result of file download operation.
func Download ¶
func Download(context context.T, input DownloadInput) (output DownloadOutput, err error)
Download is a generic utility which attempts to download smartly.