bytecounter

This commit is contained in:
2021-05-24 00:11:58 +03:00
parent 69bf4d7074
commit 98fd78bb50
6 changed files with 74 additions and 18 deletions

View File

@@ -222,15 +222,3 @@ func whiteoutDirs(whreaddir map[string]int, nlayers int) []*tree {
}
return ret
}
// byteCounter is an io.Writer that counts bytes written to it
type byteCounter struct {
rw io.Writer
n int64
}
// Write writes to the underlying io.Writer and counts total written bytes
func (b *byteCounter) Write(data []byte) (n int, err error) {
defer func() { b.n += int64(n) }()
return b.rw.Write(data)
}