Simple http client to help downloading resources
go get github.com/rlaskowski/simpleclient
This example show how to download file from url
fs:=simpleclient.NewFileStream("/home/examplepath")
url:="http://ipv4.download.thinkbroadband.com/200MB.zip"_, err:=fs.Download(url, func(streaminfo simpleclient.StreamInfo) error {
ifstreaminfo.WrittenBytes>0 {
log.Printf("Written: %.2f percent", streaminfo.ProgressInPercent())
}
ifstreaminfo.Complete {
log.Print("Complete")
}
returnnil
})
iferr!=nil {
returnerr
}