dl

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download2Buffer added in v1.1.1

func Download2Buffer(uri string) (string, []byte, error)

Download2Buffer : download a url object to bytes buffer uri -- url string for instance

uri -> https://example.com/1.jpg
    name -> 1.jpg
    data -> binary data
    err -> error return when failed

func Download2Path added in v1.1.1

func Download2Path(uri string, dir string) error

Download2Path : download a url object then save it to file uri -- url string dir -- current file dir for instance

uri -> https://example.com/1.jpg
dir -> /home/pics
would download file then save as /home/pics/1.jpg

Types

type HTTPObj added in v1.1.1

type HTTPObj struct {
	// http response
	Resp *http.Response
	// object name
	Name string
}

func DownloadObj added in v1.1.1

func DownloadObj(uri string) (*HTTPObj, error)

DownloadObj : download a url object, return http.Response and object name. Warning: Call "defer HTTPObj.Resp.Body.Close()" at the beginning. uri -- url string for instance

uri -> https://example.com/1.jpg
    HTTPObj.Resp -> http.Response
    HTTPObj.Name -> 1.jpg
    err -> error return when failed

func (*HTTPObj) Close added in v1.1.1

func (h *HTTPObj) Close() error

Jump to

Keyboard shortcuts

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