shithub: furgit

ref: 9053c85456bd9b4457b588610eeef1b8dfff2b89
dir: /format/pack/ingest/counting_writer.go/

View raw version
package ingest

import "io"

// countingWriter counts bytes written to dst.
type countingWriter struct {
	dst io.Writer
	n   int
}

// Write writes src to dst and tracks output byte count.
func (writer *countingWriter) Write(src []byte) (int, error) {
	n, err := writer.dst.Write(src)
	writer.n += n

	return n, err
}