%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/waritko/go/src/github.com/cheggaaa/pb/
Upload File :
Create Path :
Current File : //home/waritko/go/src/github.com/cheggaaa/pb/reader.go

package pb

import (
	"io"
)

// It's proxy reader, implement io.Reader
type Reader struct {
	io.Reader
	bar *ProgressBar
}

func (r *Reader) Read(p []byte) (n int, err error) {
	n, err = r.Reader.Read(p)
	r.bar.Add(n)
	return
}

// Close the reader when it implements io.Closer
func (r *Reader) Close() (err error) {
	if closer, ok := r.Reader.(io.Closer); ok {
		return closer.Close()
	}
	return
}

Zerion Mini Shell 1.0