mus-stream: A Streaming Binary Serialization Library for Go
May 6, 2026 ยท View on GitHub
mus-stream is a streaming version of the mus
serializer. It keeps the same structure but uses mus.Writer and mus.Reader
interfaces instead of byte slices.
Quick Start
Here is a small example:
package main
import "github.com/mus-format/mus-go/varint"
func main() {
var (
num = 100
size = varint.Int.Size(num)
bs = make([]byte, size)
buf = bytes.NewBuffer(bs) // Create a Writer/Reader.
)
n, err := varint.Int.Marshal(num, buf)
// ...
num, n, err = varint.Int.Unmarshal(buf)
// ...
}
For network or file-based I/O use bufio.Writer and bufio.Reader. This
ensures compatibility with mus.Writer and mus.Reader interfaces while
providing the buffering necessary for optimal performance.
Detailed documentation on core serialization concepts and supported types can be found in the mus-go repository.
Contributing & Security
We welcome contributions of all kinds! Please see CONTRIBUTING.md for details on how to get involved.
If you find a security vulnerability, please refer to our Security Policy for instructions on how to report it privately.
Version Compatibility
For a complete list of compatible module versions, see VERSIONS.md.