Proposal Details
Right now as implemented in OpenRaw() it uses a NewSectionReader to return a reader so that it could have a Read, Seek and ReadAt, but for whatever reason it is returning just an io.Reader implementation meaning that with OpenRaw it is not seekable.
Is there a good reason why the function returns io.Reader and not io.ReadSeeker so we can have more access to the bytes?
It seems like a very easy modification from:
func (f *File) OpenRaw() (io.Reader, error) {
bodyOffset, err := f.findBodyOffset()
if err != nil {
return nil, err
}
r := io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset, int64(f.CompressedSize64))
return r, nil
}
to
func (f *File) OpenRaw() (io.ReadSeeker, error) {
bodyOffset, err := f.findBodyOffset()
if err != nil {
return nil, err
}
r := io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset, int64(f.CompressedSize64))
return r, nil
}
Proposal Details
Right now as implemented in OpenRaw() it uses a NewSectionReader to return a reader so that it could have a Read, Seek and ReadAt, but for whatever reason it is returning just an io.Reader implementation meaning that with OpenRaw it is not seekable.
Is there a good reason why the function returns
io.Readerand notio.ReadSeekerso we can have more access to the bytes?It seems like a very easy modification from:
to