embroidery-ksy: open, machine-readable specs for embroidery file formats

Machine embroidery formats are mostly undocumented. If you want to read a .dst or .pes file in your own code, you usually end up reverse-engineering it, or copying a parser buried inside a large desktop application.

embroidery-ksy is my attempt to fix that: open, machine-readable Kaitai Struct specifications (.ksy) for embroidery file formats. From one spec, Kaitai Struct generates a parser for JavaScript, Python, Java, Go, C++, Rust and other languages.

It’s MIT licensed and maintained under BroideryFab.

Work in progress (pre-1.0). Most formats are partial, and some are stubs. Specs and layouts may change without notice until 1.0.

BroideryFab Web IDE: the tajima_dst spec, its object tree and a hex view of a sample DST file


Formats

The catalog is grouped by priority:

Each spec has a status on the formats page: Planned (stub only), Partial, or Complete (all known versions, tested).


How a format is laid out

Every format is self-contained:

formats/<format>/
├── <format>.ksy     the spec
├── README.md        structure, versions, quirks, sources consulted
├── samples/         redistributable sample files + MANIFEST.yaml
└── tests/           expected parse results (.json)

Shared tooling lives in tools/, and conventions are in docs/style-guide.md.


Use it

# Compiling and testing run on Node.js (no Java needed)
npm install

# Generate parsers with the npm kaitai-struct-compiler
tools/compile.sh python javascript

# Run sample tests
node tools/run_tests.js

You don’t have to build anything to try a spec. The BroideryFab Web IDE is the Kaitai Struct Web IDE with every spec and its sample files preloaded: pick a format in the file tree under broideryfab.com, open a sample next to the spec, and you get:

You can also open any .ksy file together with a sample in the stock Kaitai Web IDE.

Generated parsers (Python, JavaScript, Java, Go) and the specs are also published as zip files: an always-current edge pre-release rebuilt from main on every push after CI passes, and tagged vX.Y.Z releases.


What CI checks

On every push and pull request, CI:

  1. compiles every .ksy for Python, JavaScript, Java and Go with the JVM compiler, and fails on any error or warning;
  2. compiles the specs with the npm compiler;
  3. loads every generated JavaScript parser, parses every sample in the manifests, and checks the result against tests/*.json;
  4. publishes the full parsed tree of every sample as a JSON artifact, so you can see exactly what a spec produced.

Contribute

New formats, corrections and sample files are welcome. Start with the repository and its CONTRIBUTING.md.