Documentation ¶
Index ¶
- func CheckMD5sum(ctx context.Context, pathToFile, requiredMD5sum string) error
- func CopyByChunks(ctx context.Context, src io.Reader, dst io.Writer, readBuffer int) (nBytes int64, err error)
- func MD5sum(ctx context.Context, file io.Reader) (string, error)
- type Client
- func (c *Client) Do(ctx context.Context, method, url string, requestBody io.Reader, ...) (*http.Response, error)
- func (c *Client) Download(ctx context.Context, url, dstLocalFilePath string, permissions fs.FileMode) error
- func (c *Client) SetCorrectHttpStatus(httpStatus int) *Client
- func (c *Client) SetIgnoreCheckHttpStatus(b bool) *Client
- func (c *Client) SetRetries(count int) *Client
- func (c *Client) SetRetriesTimeout(timeout time.Duration) *Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMD5sum ¶
Calculates the md5sum of the specified file and compares it with the provided one.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient returns a new simple http client.
If [httpClient] is nil then will be used the default http client.
func (*Client) Do ¶
func (c *Client) Do(ctx context.Context, method, url string, requestBody io.Reader, headers map[string]string) (*http.Response, error)
Do makes an http request and returns its response
func (*Client) Download ¶
func (c *Client) Download(ctx context.Context, url, dstLocalFilePath string, permissions fs.FileMode) error
Download uploads the contents of the request body to the specified local file
func (*Client) SetCorrectHttpStatus ¶
SetCorrectHttpStatus sets the HTTP status code that must be returned by http request, HTTP 200 by default
func (*Client) SetIgnoreCheckHttpStatus ¶
SetIgnoreCheckHttpStatus set the value to [true] if you need to ignore HTTP status code check, default is [false]
func (*Client) SetRetries ¶
SetRetries sets the number of retries, default is 5
Click to show internal directories.
Click to hide internal directories.