util

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogIndividualTransfers = parseBool(os.Getenv("LOG_TRANSFERS"))

LogIndividualTransfers is set to the boolean value of the LOG_TRANSFERS environment variable.

View Source
var Version string

Version is the version number of swift-http-import.

Functions

func EnhancedGet

func EnhancedGet(client *http.Client, uri string, requestHeaders http.Header, segmentBytes uint64) (*http.Response, error)

EnhancedGet is like http.Client.Get(), but recognizes if the HTTP server understands range requests, and downloads the file in segments in that case.

func Log

func Log(level LogLevel, msg string, args ...interface{})

Log writes a log message. LogDebug messages are only written if the environment variable `DEBUG` is set.

Types

type FullReader

type FullReader struct {
	Base io.ReadCloser
}

FullReader is an io.ReadCloser whose Read() implementation always fills the read buffer as much as possible by calling Base.Read() repeatedly.

func (*FullReader) Close

func (r *FullReader) Close() error

Close implements the io.Reader interface.

func (*FullReader) Read

func (r *FullReader) Read(buf []byte) (int, error)

Read implements the io.Reader interface.

type LogLevel

type LogLevel int

LogLevel is the first argument to Log().

const (
	LogFatal LogLevel = iota
	LogError
	LogInfo
	LogDebug
)

Acceptable log levels.

Jump to

Keyboard shortcuts

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