limitreader

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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