0
votes

I wrote a utility for examining the contents of a zip archive, including nested zip archives. I actually implemented this in both Perl and Go, the latter of which I did yesterday.

The one thing about this algorithm that bothers me is how it examines nested archives. In order to open the nested archive, I have to write the content of the nested archive to a temporary file on disk, and then read it in again to open the nested archive.

Particularly with the golang implementation, I would like to avoid that. I would like to be able to open the nested archive directly from memory. I've examined the archive/zip package, and I don't see an obvious way to do this.

You may do so if you read the embedded zip into a byte buffer, and use that to open it. But you have to read it all.icza
NewReader does not require a file on disk, but it does require a seekable reader. Read the contents of the nested zip to a []byte and create a bytes.NewReader with the []byte to get a seekable reader.gopher
I could use a little more explanation here. I don't understand how to get a ReaderAt from a []byte.David M. Karr