Original post

Currently, I’m writing a dynamic zip from a given offset/length – to make “storage only” zip files able to be served as multipart without them having to ever exist on the filesystem.

The zip files I’m generating can be many gigabytes in size.

I’ve got the zip part handled, but need some advice on how to use the http.ServeContent.

Currently my code is as follows

z := NewZipWriter(man) // the io.Writer to send the zip to. z.writer = &testWriter{} // get the size of the zip z.Size() // offset, length // start at pos 4, write 100 bytes z.Process(4, 100) // start at pos 0, write all bytes z.Process(0, 0) 

So, basically I have an io.Writer – and can read the size, and write bytes at any part of the zip file.

Are there any examples of the ReadSeeker working with something similar? I don’t understand how I’m meant to make these work. http.serveContent is very “private” with all of it’s handling of range requests, but seems quite indepth. I’m not too keen on rolling my own range request serving conditions.

submitted by /u/softgripper
[link] [comments]