|
1 | 1 | # Marshal and Unmarshal Binary Formats in Go |
2 | | -This module is a drop-in replacement for the standard library package |
3 | | -[`encoding/binary`](https://pkg.go.dev/encoding/binary) |
4 | | -of the Go programming language and |
5 | | -provides the missing `Marshal()` and `Unmarshal()` functions |
6 | | -a la `encoding/json` and `encoding/xml`. |
7 | | - |
8 | | -## Intended Audience |
9 | | -This module is useful to developers |
10 | | -implementing binary message and file format specifications |
11 | | -using the Go programming language. |
12 | | -Whereas stable implementations of most open-source formats |
13 | | -are readily available, |
14 | | -proprietary formats often require bespoke solutions. |
15 | | -The Go standard library provides convenient functions |
16 | | -`Marshal()` and `Unmarshal()` |
17 | | -for converting Go structs into text-based data formats |
18 | | -(such as [JSON](https://pkg.go.dev/encoding/json#Marshal) and |
19 | | -[XML](https://pkg.go.dev/encoding/xml#Marshal)) |
20 | | -and vice versa, |
21 | | -but their counterparts for binary formats |
22 | | -are sorely missing from the package `encoding/binary`. |
| 2 | +The Go standard library features packages for marshalling structs |
| 3 | +into text-based message and file formats, and vice versa. |
| 4 | +Packages `encoding/json` and `encoding/xml` are well known |
| 5 | +for the convenient functions `Marshal()` and `Unmarshal()` they provide |
| 6 | +that leverage the declarative nature of struct tags. |
| 7 | +These functions are however missing from |
| 8 | +[`encoding/binary`](https://pkg.go.dev/encoding/binary), |
| 9 | +leaving developers without an accessible and intuitive way |
| 10 | +to work with binary formats. |
| 11 | + |
| 12 | +This module is a drop-in replacement for `encoding/binary` |
| 13 | +supplying the missing functions |
| 14 | +so that developers can define custom binary formats using only struct tags and |
| 15 | +convert between structs and byte slices |
| 16 | +using `Marshal()` and `Unmarshal()` with their familiar signatures, |
| 17 | +all while retaining precise, bit-level control over data structures. |
23 | 18 |
|
24 | 19 | ## Binary Formats |
25 | 20 | Message and file formats specify how bits are arranged to encode information. |
|
0 commit comments