Create new buffer/byte array ([]byte
)
io.Reader
is an interface that wraps the basic Read method.
Read
reads up to len(p)
bytes into p
number of bytes
read (0 <= n <= len(p))
and any error
encounteredtype Reader interface { Read(p []byte) (n int, err error) }
It is useful when
import ( "bytes" ) func main() []byte { buf := new(bytes.Buffer) return buf.Bytes() }