ref: e7ce17381f525328073577d60583447fc9412c18
dir: /packfile/ingest/counting_writer.go/
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
}