Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLimitedReaderLimitReached = errors.New("read limit reached")
ErrLimitedReaderLimitReached indicates that the read limit has been reached.
Functions ¶
This section is empty.
Types ¶
type LimitedReader ¶
type LimitedReader struct { Count int64 // contains filtered or unexported fields }
LimitedReader reads from a reader up to a specific limit. When this limit has been reached, any subsequent read will return ErrLimitedReaderLimitReached. The underlying reader has to implement io.ReadCloser so that it can be used with http request bodies.
func NewLimitedReader ¶
func NewLimitedReader(r io.ReadCloser, limit int64) *LimitedReader
NewLimitedReader creates a new LimitedReader.
func (*LimitedReader) Close ¶
func (r *LimitedReader) Close() error
Close closes the underlying reader.
Click to show internal directories.
Click to hide internal directories.