func NewPackfileBuilder(w io.Writer) (*PackfileBuilder, error) {
	hash, err := sum.New()
	if err != nil {
		return nil, err
	}
	w = io.MultiWriter(w, hash)
	cw := countingWriter{w, 0}
	b := PackfileBuilder{
		w:      &cw,
		idx:    make([]BlockInfo, 0),
		seq:    0,
		closed: false,
		hash:   hash,
	}
	return &b, nil
}
NewPackfileBuilder creates a new PackfileBuilder
package object
import (
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"github.com/jotfs/jotfs/internal/compress"
	"github.com/jotfs/jotfs/internal/sum"
)
type PackfileBuilder struct {
	w      *countingWriter
	idx    []BlockInfo
	seq    uint64
	closed bool
	hash   *sum.Hash
}