artifact

package
v0.0.0-...-7638cb1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package artifact contains utilities for working downloading files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileCopy

func FileCopy(log log.T, destinationPath string, src io.Reader) (written int64, err error)

FileCopy copies the content from reader to destinationPath file

func ListS3Folders

func ListS3Folders(log log.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

func Md5HashValue(log log.T, filePath string) (hash string, err error)

Md5HashValue gets the md5 hash value

func Sha256HashValue

func Sha256HashValue(log log.T, filePath string) (hash string, err error)

Sha256HashValue gets the sha256 hash value

func VerifyHash

func VerifyHash(log log.T, input DownloadInput, output DownloadOutput) (match bool, err 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
	SourceHashValue      string
	SourceHashType       string
}

DownloadInput specifies the input to file download operation

type DownloadOutput

type DownloadOutput struct {
	LocalFilePath string
	IsUpdated     bool
	IsHashMatched bool
}

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.

Jump to

Keyboard shortcuts

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