Skip to content

Commit dba3c64

Browse files
committed
docs(issue-1): README .pbf.json container section + PLAN — all executables done
1 parent bd5aba2 commit dba3c64

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

PLAN.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,16 @@ Schema: data LAST; optional POSIX/birthtime fields omitted when unavailable.
102102

103103
NOTE: local web preview server (node) still running on http://localhost:8099/ (bg
104104
task biipba32h) — kill when done; the live GitHub Pages site also reflects 7b70844c.
105+
106+
## ALL EXECUTABLES DONE (2026-06-27) — issue #1 fully delivered
107+
Every printable-binary executable understands .pbf.json (-C/--container):
108+
- [x] JS library + web demo (Interface A) [x] C FFI CLI (dogfoods pb_crc32)
109+
- [x] Node CLI [x] C standalone CLI
110+
- [x] Zig CLI [x] Lua reference CLI
111+
- [x] Transport-resistance (canonicalize + lenient/pattern parse) in ALL impls
112+
- [x] crc32 vector-pinned (CRC32("123456789")=0xCBF43926) across all
113+
- [x] CI guards: test-container-{node,zig,ffi,c,lua} + test-container-cross
114+
(comprehensive MFIC differential: every impl decodes the Node reference's
115+
container byte-identically, and vice versa)
116+
Shared: src/container_json.h (C), test/test_container (parameterized),
117+
test/test_container_cross (differential).

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,47 @@ echo -n "Hello, World!" | ./bin/printable-binary --passthrough 2>encoded.txt | w
134134
- Default wrapping is 75 characters per line to balance readability and density; copy/download buttons reuse the exact bytes produced by the CLI and Node implementations.
135135
- To hack locally, open `docs/index.html` (or `index.html`) in any modern browser; the page loads the shared `js/printable_binary.js` module with no build step required.
136136

137+
### File Container (`.pbf.json`)
138+
139+
The `-C`/`--container` flag wraps a file as a self-describing
140+
**`printable-binary-file.json`** — one JSON object that keeps the filename and a
141+
CRC-32 integrity check alongside the encoded data, so a decode can restore the
142+
original file and verify it round-tripped exactly.
143+
144+
```bash
145+
# Encode a file into a container (filename + crc32 embedded)
146+
./bin/printable-binary -C photo.png > photo.png.pbf.json
147+
148+
# Decode the container back to the original bytes (verifies crc32)
149+
./bin/printable-binary -d -C photo.png.pbf.json > photo.png
150+
```
151+
152+
Every implementation understands it (Lua, Node, C, Zig, the C-FFI CLI, and the
153+
browser demo) and they produce **mutually-decodable** containers. The format is
154+
**transport-resistant**: the encoded payload is whitespace-agnostic and
155+
`crc32_encoded` is verified over the canonical (whitespace-stripped) payload —
156+
with a lenient JSON parse for hard line-wraps — so a container survives being
157+
pasted into an email body or reflowed by a text transport, while a genuine
158+
(non-whitespace) corruption is still rejected. Schema (v1, `data` serialized
159+
last so metadata reads up front):
160+
161+
```json
162+
{
163+
"format": "printable-binary-file",
164+
"version": 1,
165+
"filename": "photo.png",
166+
"byte_length": 12345,
167+
"crc32": "cbf43926",
168+
"crc32_encoded": "1a2b3c4d",
169+
"data": "…encoded glyphs…"
170+
}
171+
```
172+
173+
The browser demo's **Decode** tab consumes the same container (drag-drop or
174+
paste) and restores the file under its original name. Optional metadata
175+
(timestamps, POSIX permissions/owner) is included when the tool can read it and
176+
omitted otherwise; decode never fails on a missing optional field.
177+
137178
### As a Lua Library
138179

139180
```lua

0 commit comments

Comments
 (0)