Is there an implementation of io.ReadWriteSeeker
to use in Golang?
Since, bytes.Buffer
does not implement Seek
method, I need to find such an implementation to use as a buffer written by zipwriter
and to be read with seeking.
In addition I wont go with Reader(buff.Bytes())
to covert with memory copy, because I can not afford double memory size for buffered data.
In addition, when using os.File
as the option, if I wont call f.Sync
, it will never touch file system, right? Thanks.
My simplified codes:
func process() {
buff := new(bytes.Buffer)
zipWriter := zip.NewWriter(buff)
// here to add data into zipWriter in sequence
zipWriter.Close()
upload(buff) // upload(io.ReadSeeker)
}