On Wed, Mar 17, 2021 at 7:38 PM Glen Newton <glen.new...@gmail.com> wrote:
>
> zip archives contain files and directories. Often, some of the files 
> contained in zip archives are also archives, zip and tar(.gz|bz2). Sometimes, 
> these contained archives also contain such archives (and so on...).
>
> Reading a zip file requires an io.ReaderAt in the func zip.NewReader(r 
> io.ReaderAt, size int64) (*Reader, error) This function returns a 
> *zip.Reader, which exposes an array of *zip.File, which can be opened with 
> func (f *File) Open() (io.ReadCloser, error).
>
> So reading any zip archives contained in a zip archive is not supported, as 
> the  zip.Reader[n].File.Open() returns a ReadCloser, not an io.ReaderAt.

I disagree. io.Reader and io.ReaderAt are fundamentally different and
that's fine. But that in no way prevents creating an io.ReadAt from an
io.Reader when needed/necessary. I think it is thus not necessary to
extend any API only to avoid coding a simple custom type. The 'custom'
is important here. A general solution exists, but it will be
sub-optimal in many, or maybe most cases.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-XqABXFphnMKhegZqoCFjtObteX2-4kHV2w-XtoLTQpFQ%40mail.gmail.com.

Reply via email to