code: func (h *ArchiveHandler) newArchiveFromGuest(u *url.URL) (File, error) {
  	r, w := io.Pipe()
  
  	a := &archive{
  		name:   u.Path,
  		done:   r.Close,
  		Reader: r,
  		Writer: w,
  	}
  
  	var z io.Writer = w
  	var c io.Closer = ioutil.NopCloser(nil)
  
  	switch u.Query().Get("format") {
  	case "tgz":
  		gz := gzip.NewWriter(w)
  		z = gz
  		c = gz
  	}
  
  	tw := tar.NewWriter(z)
  
  	go func() {
  		err := h.Write(u, tw)
  
  		_ = tw.Close()
  		_ = c.Close()
  		if gzipTrailer {
  			_, _ = w.Write(gzipHeader)
  		}
  		_ = w.CloseWithError(err)
  	}()
  
  	return a, nil
  }
docs: // newArchiveFromGuest returns an hgfs.File implementation to read a directory as a gzip'd tar.