Buffer.Concat
Overview
Concat joins buffers (Buffer.concat).
If you are coming from Node.js, the closest pattern is Buffer.concat(list).
Method on Buffer — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func Concat(parts ...Buffer) BufferCompare: Node.js · Standard Go · gox
js
Buffer.concat([buf1, buf2]);go
b := append([]byte(nil), parts...)go
import "github.com/sahilkhaire/gox/buffer"
combined := buffer.Concat(buf1, buf2)Example
go
import "github.com/sahilkhaire/gox/buffer"
combined := buffer.Concat(buf1, buf2)Tips
Obtain a Buffer value first (see constructors on the package overview), then call Concat.
Standard library alternative
Use the standard library directly:
go
b := append([]byte(nil), parts...)