go-sizeio
Extends readers with an additional method Size returning the size of the reader content. See the documentation for more information.
Installation
Add this package to go.mod
and go.sub
in your Go project:
go get github.com/prantlf/go-sizeio
Usage
Use convenience methods to create readers with the extra Size
method:
import "github.com/prantlf/go-sizeio"
readerWithSize := sizeio.OpenFile("...")
readerWithSize := sizeio.SizeReader(otherReader, 456)
_, ok := someReader.(sizeio.WithSize)
size := readerWithSize.Size()
See the documentation for the full interface.