Question regarding zip and io.Reader/io.Writer. As far as I understand, one of the purpose of io/Reader/io.Writer is streaming. But should I implement one of these if my type does not really make sense "as chunks"?
For more details:
Lets say I have this struct.
type MyZip struct {
file1, file2 []byte
}
MyZip represents a particular structured zip. Let's say for example it represents a zip file containing exactly a file named file1 and a file named file2. MyZip has the responsibility of parsing a zip file to extract these two files into two []byte fields. It also should handle the other way around (turning these two []byte fields as two files named test1 and test2 archived into a zip file).
As far as I understand, the package archive/zip does not allow to decompress a zip file as a stream. We have to fully load the zip in memory or as a file and decompress afterwards.
So to refine my question, does it make sense for MyZip to implement io.Reader/io.Writer for reading/writing from/to the final zip file?
As said above, as I cannot extract the two files on the fly, I would have to add some sort of buffer to MyZip and just read/write from/to this buffer. So the zip would anyway be fully stored in memory before being streamed. Is it a counter indication for not using io.Reader/io.Writer?
Thanks a lot for shedding light!