func (f *fileSection) Size() (int64, error) {
	info, err := f.f.Stat()
	if err != nil {
		return 0, err
	}
	size := info.Size() - f.start
	if size < 0 {
		size = 0
	}
	if size > f.end-f.start && f.end != remainingFile {
		size = f.end - f.start
	}
	return size, nil
}
Size uses the underlying file's stats to return the size of the sector.
package proto
import (
	"os"
)
type fileSection struct {
	f     *os.File
	start int64
	end   int64
}
func newFileSection(f *os.File, start, end int64) *fileSection {
	if start < 0 {
		panic("filesection can't start at an index < 0")
	}
	if end < start && end != remainingFile {
		panic("the end of a filesection can't be before the start")
	}
	return &fileSection{
		f:     f,
		start: start,
		end:   end,
	}
}
func (f *fileSection) Close() error {
	return f.f.Close()
}