fs

package
v0.0.0-...-7ba06b6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(url string, downloadTofileName string)

Download performs file download of the given url this method provides no feedback to the system

func DownloadExtract

func DownloadExtract(url string, assetName string) error

DownloadExtract sets up and runs the functions needed for downloading and extracting of assets

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile will download a url to a local file. efficiently writes as it downloads instead of loading file in memory io.TeeReader is passed into Copy() to report progress on the download

func Exists

func Exists(name string) bool

Exists reports if the named file or directory exists

func Extract

func Extract(assetName string, downloadLocation string, extractPath string)

Extract will call Unzip or Untar depending on the detected file extension

func GetCurrentPath

func GetCurrentPath() (string, error)

GetCurrentPath gets the path of the go app

func Untar

func Untar(gzStream string, dst string) error

Untar takes a destination path and a reader; a tar reader loops over the tarfile creating the file structure at 'dst' along the way, and writing any files

func Unzip

func Unzip(src, dest string) error

Unzip takes a src and destination path and unzips accordingly

Types

type WriteCounter

type WriteCounter struct {
	Total uint64
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (WriteCounter) PrintProgress

func (wc WriteCounter) PrintProgress()

PrintProgress will print current status of download

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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