func (d *Demuxer) Read(b []byte) (n int, err error) {
	var read, req int
	req = len(b)
	for read < req {
		n, err := d.doRead(b[read:req])
		read += n
		if err != nil {
			return read, err
		}
	}
	return read, nil
}
Read reads up to len(p) bytes from the PackData channel into p, an error can
be return if an error happens when reading or if a message is sent in the
ErrorMessage channel.

When a ProgressMessage is read, is not copy to b, instead of this is written
to the Progress
package sideband
import (
	"errors"
	"fmt"
	"io"
	"gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
)
var ErrMaxPackedExceeded = errors.New("max. packed size exceeded")
type Progress interface {
	io.Writer
}
type Demuxer struct {
	t Type
	r io.Reader
	s *pktline.Scanner
	max     int
	pending []byte
	Progress Progress
}
func NewDemuxer(t Type, r io.Reader) *Demuxer {
	max := MaxPackedSize64k
	if t == Sideband {
		max = MaxPackedSize
	}
	return &Demuxer{
		t:   t,
		r:   r,
		max: max,
		s:   pktline.NewScanner(r),
	}
}