limitreader

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LimitReader

type LimitReader struct {
	Src     io.Reader
	Limiter *ratelimiter.RateLimiter
	// contains filtered or unexported fields
}

LimitReader reads stream with RateLimiter.

func NewLimitReader

func NewLimitReader(src io.Reader, rate int64, calculateMd5 bool) *LimitReader

NewLimitReader creates a LimitReader. src: reader rate: bytes/second

func NewLimitReaderWithLimiter

func NewLimitReaderWithLimiter(rl *ratelimiter.RateLimiter, src io.Reader, calculateMd5 bool) *LimitReader

NewLimitReaderWithLimiter creates LimitReader with a rateLimiter. src: reader rate: bytes/second

func NewLimitReaderWithLimiterAndMD5Sum

func NewLimitReaderWithLimiterAndMD5Sum(src io.Reader, rl *ratelimiter.RateLimiter, md5sum hash.Hash) *LimitReader

NewLimitReaderWithLimiterAndMD5Sum creates LimitReader with rateLimiter and md5 sum. src: reader rate: bytes/second

func NewLimitReaderWithMD5Sum

func NewLimitReaderWithMD5Sum(src io.Reader, rate int64, md5sum hash.Hash) *LimitReader

NewLimitReaderWithMD5Sum creates LimitReader with a md5 sum. src: reader rate: bytes/second

func (*LimitReader) Md5

func (lr *LimitReader) Md5() string

Md5 calculates the md5 of all contents read.

func (*LimitReader) Read

func (lr *LimitReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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