Skip to content

Extends readers with an additional method Size returning the size of the reader content.

License

Notifications You must be signed in to change notification settings

prantlf/go-sizeio

Repository files navigation

go-sizeio

PkgGoDev Test Status codecov

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"
// get a file reader/closer with the size available right away
readerWithSize := sizeio.OpenFile("...")
// get a general reader with the size known ahead
readerWithSize := sizeio.SizeReader(otherReader, 456)
// test any reader whether it supports the Size method
_, ok := someReader.(sizeio.WithSize)
// get the size of the reader content
size := readerWithSize.Size() // returns 456 as in64

See the documentation for the full interface.

About

Extends readers with an additional method Size returning the size of the reader content.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published