Skip to content

SqrtExpipi/spec-to-bin

Repository files navigation

Spec to BIN

Build test binaries from specs.

Spec to BIN is a browser-based tool for creating communication packets, embedded settings, EEPROM images, initialization BIN files, and test payloads from structured JSON templates.

It is not a general-purpose hex editor. The goal is to reduce manual hex editing by letting you define binary structure, edit values in a GUI, validate errors, preview bytes, and export .bin files.

Open Spec to BIN

Spec to BIN field editor and Hex preview in the light theme

More screenshots

Dark theme

Spec to BIN in the dark theme

Inline validation

Spec to BIN showing an expected-offset validation error

Privacy

  • Runs locally in your browser.
  • No upload of JSON templates, generated BIN files, field values, or specification-derived data.
  • No telemetry.
  • No built-in AI API integration.
  • Release builds include a self-contained offline ZIP.

Features in v0.1

  • Load and save JSON binary templates
  • Edit names, types, sizes, formats, values, notes, and expected offsets in a table
  • Reorder, add, duplicate, and delete fields
  • Undo and redo edits, with unsaved-change warnings
  • Show offsets and byte sizes
  • Show field validation directly below the affected row
  • Validate expected offsets against calculated offsets
  • Preview generated hex bytes above the editor and highlight the selected field
  • Switch the text preview between ASCII, UTF-8, and Shift_JIS without changing generated bytes
  • Copy generated bytes as 0x list, plain hex, C array, Python bytes, or C# byte[]
  • Save .bin
  • English and Japanese UI
  • System, light, and dark themes
  • PWA and offline use

Supported field types

  • uint8
  • uint16
  • uint32
  • uint64 (JSON string value)
  • int8
  • int16
  • int32
  • int64 (JSON string value)
  • bytes
  • string
  • ipv4
  • padding

Supported browsers

The current release targets the latest stable versions of Google Chrome and Microsoft Edge. Other browsers may work, but are not part of the v0.1 test scope.

Known limitations

  • CRC and checksum fields are not calculated automatically. Enter precomputed values as ordinary numeric or byte fields.
  • Existing BIN files cannot be parsed back into templates.
  • Repeat structures, variable-length structures, bit fields, floating-point fields, and conditional fields are not supported.
  • The web/PWA build must be served over HTTP(S). Use the release ZIP when direct file:// and offline operation are required.
  • Preview and text-copy output are intentionally capped; larger valid binaries can still be saved within the generated-binary limit below.

Quick start

npm install
npm run dev

Build

npm run build

dist is the web/PWA build and must be served over HTTP(S). It is not intended to be opened directly with file://.

Offline build

npm run build:offline

Open dist-offline/index.html directly in a browser. The JavaScript and CSS are embedded in that one file. Tagged GitHub releases package this output as an offline ZIP.

Test

npm run test:run

Sample JSON

The editor starts with a blank template. Load a general-purpose sample from the reset menu, or use a JSON template such as:

{
  "formatVersion": "0.1",
  "name": "basic_fields",
  "defaultEndian": "big",
  "defaultEncoding": "utf-8",
  "fields": [
    {
      "name": "unsignedValue",
      "type": "uint16",
      "offset": 0,
      "value": "0x000F"
    },
    {
      "name": "label",
      "type": "string",
      "offset": 2,
      "length": 8,
      "encoding": "utf-8",
      "padding": "zero",
      "value": "SAMPLE"
    }
  ]
}

More examples are available in examples.

Safety limits

  • JSON file/editor input: 5 MiB
  • Fields: 5,000
  • One variable-size field: 16 MiB
  • Generated binary: 64 MiB
  • Hex preview: first 8 KiB
  • Text copy formats: 64 KiB

Unknown JSON properties are preserved when possible and reported as warnings. Errors block preview, copy, and BIN export; warnings do not.

Documentation

Deferred features

These are intentionally outside the first version:

  • Built-in AI API integration
  • TCP/UDP send
  • Existing BIN reverse parsing
  • CRC/checksum
  • repeat structures
  • lengthOf/countOf/offsetOf auto fields
  • batch generation
  • CLI
  • desktop executable

License

MIT

About

Generate test binary files from structured JSON with GUI editing, validation, and Hex preview.

Topics

Resources

License

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors