code: func WriteIndex(w io.Writer, idx *Index, typ string) error {
  	idx.sort()
  	err := writeIndices(w, idx.Refs, typ)
  	if err != nil {
  		return err
  	}
  	if idx.Unmapped != nil {
  		err = binary.Write(w, binary.LittleEndian, *idx.Unmapped)
  	}
  	return err
  }
docs: // WriteIndex writes the Index to the given io.Writer.