A Go library for packing and unpacking binary data streams with support for multiple data types and endianness.
binpacker is a Go library for serializing and deserializing binary data streams. It provides a clean API to pack various data types into binary format and unpack them back, handling byte ordering and type conversions automatically. It solves the problem of manually managing binary encoding/decoding when working with custom protocols or file formats.
Go developers who need to implement binary protocols, parse binary file formats, or communicate with hardware devices using raw binary data.
Developers choose binpacker for its simplicity and integration with Go's standard library, eliminating the need for repetitive binary encoding/decoding code. Its fluent API and centralized error handling make binary data manipulation more readable and less error-prone.
A binary stream packer and unpacker
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables method chaining for concise packing/unpacking, as shown in README examples like `packer.PushByte(...).PushUint16(...)`, improving code readability and reducing boilerplate.
Leverages Go's encoding/binary package for endianness handling, ensuring reliability and seamless compatibility with existing Go codebases without extra dependencies.
Provides an `Error()` method to validate operations after chained calls, simplifying error management compared to manual checks after each step.
Operates directly on bytes.Buffer objects, allowing easy integration with I/O streams and memory buffers for versatile data handling scenarios.
Requires explicit calls for each field in complex structures, making it tedious for large or nested data compared to libraries with struct tag support or automatic reflection.
Lacks built-in features for common binary formats (e.g., compression, checksums) or advanced types like maps, forcing developers to implement additional logic themselves.
Relies heavily on GoDoc with sparse examples beyond basics, which can slow down onboarding for non-trivial use cases like handling variable-length data.