func (r *Reader) Header() (t plumbing.ObjectType, size int64, err error) {
	var raw []byte
	raw, err = r.readUntil(' ')
	if err != nil {
		return
	}
	t, err = plumbing.ParseObjectType(string(raw))
	if err != nil {
		return
	}
	raw, err = r.readUntil(0)
	if err != nil {
		return
	}
	size, err = strconv.ParseInt(string(raw), 10, 64)
	if err != nil {
		err = ErrHeader
		return
	}
	defer r.prepareForRead(t, size)
	return
}
Header reads the type and the size of object, and prepares the reader for read
package objfile
import (
	"compress/zlib"
	"errors"
	"io"
	"strconv"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/format/packfile"
)
var (
	ErrClosed       = errors.New("objfile: already closed")
	ErrHeader       = errors.New("objfile: invalid header")
	ErrNegativeSize = errors.New("objfile: negative object size")
)
type Reader struct {
	multi  io.Reader
	zlib   io.ReadCloser
	hasher plumbing.Hasher
}
func NewReader(r io.Reader) (*Reader, error) {
	zlib, err := zlib.NewReader(r)
	if err != nil {
		return nil, packfile.ErrZLib.AddDetails(err.Error())
	}
	return &Reader{
		zlib: zlib,
	}, nil
}