Skip to content

Commit 7b70844

Browse files
committed
feat(web): Interface A — Encode/Decode tabs + .pbf.json decode & metadata (issue #1)
Rebuilds the browser demo around explicit Encode/Decode tabs (Peter's pick) so decoding is discoverable — the issue's core complaint. Decode accepts a pasted block OR a dropped file, auto-routes container vs raw (decodeText), shows a metadata panel (filename/size/modified/mode/integrity), and downloads the restored file under its original name. Encode gains a .pbf.json container output option (embeds filename + modified_ms + crc32). Adds decodeText (decode-mode router, robust to raw output starting with '{') and serializes container 'data' LAST so metadata sits up front (Peter's ask). JS suite now 54 tests (routing + corrupt-container rejection + data-last order).
1 parent 56d2c93 commit 7b70844

4 files changed

Lines changed: 411 additions & 463 deletions

File tree

docs/plans/2026-06-26-printable-binary-file-container-design.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,24 @@ NEW option, not a replacement.
4242
"format": "printable-binary-file",
4343
"version": 1,
4444
"filename": "photo.png",
45-
"data": "<printable-binary-encoded string>",
4645
"byte_length": 12345,
4746
"crc32": "cbf43926",
4847
"crc32_encoded": "1a2b3c4d",
4948
"modified_ms": 1719430000000,
5049
"created_ms": 1719420000000,
5150
"mode": "0644",
5251
"owner": "pmarreck",
53-
"group": "staff"
52+
"group": "staff",
53+
"data": "<printable-binary-encoded string>"
5454
}
5555
```
5656

57+
Serialized with `data` LAST so all metadata sits up front (JS object key order
58+
is insertion order). `created_ms` is birthtime — populated by the CLI (which can
59+
`stat` it); browsers expose only `lastModified` (-> `modified_ms`), so the web
60+
encoder omits `created_ms` (the web decoder still shows it when a CLI-made
61+
container carries it).
62+
5763
### Field semantics
5864
| key | type | required | meaning |
5965
|----------------|---------|----------|---------|

0 commit comments

Comments
 (0)