About

ebyte.org is the home of EByte, a small engine for binary file formats. You describe a format once, in a JSON schema: which fields come first, how wide each one is, which byte order, how many records follow. EByte then uses that one description three ways. It reads a file into JSON you can edit, it writes edited JSON back into a binary file, and it traces a file field by field, so when something doesn’t match you get the field, the byte offset and what was expected.

Why It Exists

Most binary formats get described more than once. There’s a reader in one place, a writer somewhere else, and a hex editor template someone made while debugging. Each copy drifts from the others. EByte keeps the description in one file and makes the reader, the writer and the debugging view come from it, so a mistake in the schema shows up everywhere at once instead of hiding in one of three places.

The rule it holds itself to is simple to state. Decode a file, encode the result without changes, and you get the same bytes back. Padding, reserved bytes, NULs and trailing spaces all survive, because the schema has to declare them.

What It Is

  • A Go library. Import github.com/softdevstudio/ebyte, compile a schema, then decode, inspect or encode with any io.Reader or io.Writer.
  • One command-line tool. ebyte validate-schema, decode, encode and inspect, with the same interpreter underneath as the library.
  • Bounded on purpose. Every size has a ceiling: 16 MiB of binary input, 65,536 elements per array, 100,000 values. You can lower the ceilings, never raise them.

There’s no code generation, no hosted service and nothing to sign up for. The schema reference lists everything a schema can say, and the command reference covers the tool.

Where It Stands

Version 0.1 is out. It handles integers of 8 to 64 bits in either byte order, ASCII and UTF-8 strings of fixed or referenced length, raw byte fields, counted arrays (nested too), equality conditions and counts the encoder works out for you. It doesn’t do floating point, bit fields, seeking to an offset or arithmetic between fields yet. Structural diff, comparing two files field by field through a schema, is planned for a later release.

Open Source

EByte is free and open source under the Apache License 2.0. The code, the tests and the recorded test results are on GitHub. Questions and ideas are welcome on the contact page.