code: func (dh *DownloadHandler) zipFile(ctx context.Context, parentPath string, br blob.Ref, zw *zip.Writer) error {
  	if len(dh.pathByRef) == 0 {
  		// if dh.pathByRef is not populated, we have to check for ourselves now whether
  		// br is a directory.
  		di, err := dh.dirInfo(ctx, br)
  		if err != nil && err != errNotDir {
  			return err
  		}
  		if di.isDir {
  			for _, v := range di.children {
  				if err := dh.zipFile(ctx, filepath.Join(parentPath, di.name), v, zw); err != nil {
  					return err
  				}
  			}
  			return nil
  		}
  	}
  	fi, _, err := dh.fileInfo(ctx, br)
  	if err != nil {
  		return err
  	}
  	defer fi.close()
  	filename, ok := dh.pathByRef[br]
  	if !ok {
  		// because we're in the len(dh.pathByRef) == 0 case.
  		filename = filepath.Join(parentPath, fi.name)
  	}
  	zh := &zip.FileHeader{
  		Name:   filename,
  		Method: zip.Store,
  	}
  	zh.SetModTime(fi.modtime)
  	zh.SetMode(fi.mode)
  	zfh, err := zw.CreateHeader(zh)
  	if err != nil {
  		return err
  	}
  	_, err = io.Copy(zfh, fi.rs)
  	if err != nil {
  		return err
  	}
  	return nil
  }
docs: // zipFile, if br is a file, adds br to the zip archive that zw writes to. If br
  // is a directory, zipFile adds all its files descendants to the zip. parentPath is
  // the path to the parent directory of br. It is only used if dh.pathByRef has not
  // been populated (i.e. if dh does not use a caching fetcher).