title: In memory ReadSeeker
body: <p>I write a service that download images, join it via zip archive and upload it back to aws. This service should be time-efficient.
  My first <a href="https://github.com/abonec/remote_archiver/" rel="nofollow noreferrer">version</a> was dead simple:</p>
  
  <ol>
  <li>Download all files in parallel and save to the disk.</li>
  <li>Read all files from the disk, join it by zip package and save back to the disk</li>
  <li>Read archive from the disk and send it to the s3.</li>
  </ol>
  
  <p>But I think all those save and read from disk operations is less performant than in memory communication.</p>
  
  <p>I <a href="https://github.com/abonec/remote_archiver/tree/feature/in_memory" rel="nofollow noreferrer">joined</a> downloading and archiving together (all download readers going directly to the archiver). But I can't understand how to join it with the uploader.</p>
  
  <p>S3 uploader need a <strong>ReadSeeker</strong> to put object. Current implementation of archiver is:</p>
  
  <pre><code>func Archive(inputQueue &lt;-chan Input) io.ReadSeeker {
      zipFile, err := os.Create("test_arch.zip")
      if log.Error(err) {
          os.Exit(1)
      }
  
      arch := zip.NewWriter(zipFile)
      go func() {
          defer arch.Close()
          for input := range inputQueue {
              header := &amp;zip.FileHeader{
                  Name:   filepath.Join(baseDir, input.Path()),
                  Method: zip.Store,
              }
              writer, err := arch.CreateHeader(header)
              if log.Error(err){
                  os.Exit(1)
              }
              _, err = io.Copy(writer, input.Reader())
          }
  
      }()
  
      return zipFile
  }
  </code></pre>
  
  <p>It save archive to the disk.
  How to write archihve to intermediate structure to pass this structure to s3 uploader that <a href="https://github.com/abonec/remote_archiver/blob/3310a9a733c1c3a51cb181517bf44480859710e5/upload.go#L41" rel="nofollow noreferrer">require</a> a <strong>ReadSeeker</strong>?</p>