mirror of
https://github.com/octoleo/restic.git
synced 2024-12-27 20:45:19 +00:00
16 lines
432 B
Go
16 lines
432 B
Go
|
package util
|
||
|
|
||
|
import "io"
|
||
|
|
||
|
// LimitedReadCloser wraps io.LimitedReader and exposes the Close() method.
|
||
|
type LimitedReadCloser struct {
|
||
|
io.Closer
|
||
|
io.LimitedReader
|
||
|
}
|
||
|
|
||
|
// LimitReadCloser returns a new reader wraps r in an io.LimitedReader, but also
|
||
|
// exposes the Close() method.
|
||
|
func LimitReadCloser(r io.ReadCloser, n int64) *LimitedReadCloser {
|
||
|
return &LimitedReadCloser{Closer: r, LimitedReader: io.LimitedReader{R: r, N: n}}
|
||
|
}
|