@wnlx/o2-client
v1.0.10
Published
A Bun TCP object-storage prototype with a binary protocol and interactive client.
Readme
origin-o2
A Bun TCP object-storage prototype with a binary protocol and interactive client.
bun install
HOSTNAME=127.0.0.1 PORT=50202 bun src/index.tsIn another terminal:
HOSTNAME=127.0.0.1 PORT=50202 bun src/client.tsThe server uses BASEPATH=./data by default and stores objects under BASEPATH/storage/<namespace>/<key>. The client saves completed downloads under ./downloads/<namespace>/<key>, relative to its working directory. HOSTNAME defaults to localhost only when the environment variable is unset; set it explicitly if your shell already supplies it.
The client requests an authentication challenge automatically. Example commands:
!AUTH admin:admin123
0x02
0x02 assets
0x08 assets:/toy-story-2-airport-car-chase-dub.mp4
0x08 assets:/story.txt CHUNK_SIZE=65536
0x03 empty-namespace
0x04 empty-namespace
0x0fThe raw command format is <opcode> <param/0> <flags/0> <body/0>; omitted fields default to 0 (empty). Supported commands have no request body. The prototype credentials are admin:admin123 and user:user123; this transport currently uses plain TCP.
Downloads stream through bounded buffers to unique .part files. A completed transfer atomically replaces its destination; failed or interrupted transfers remove their temporary files and preserve an existing destination. Input remains available during transfers. Commands on one connection execute in order, so another retrieval or listing waits for the active retrieval. Ctrl+C cancels the connection; EOF queues a graceful goodbye after submitted commands.
Namespace deletion succeeds only for empty namespaces. Upload opcodes are reserved but not implemented. See O2_DOC.md for the implemented protocol; O2_CONCEPT.md is an earlier design, not the current wire format.
Type-check with:
bunx tsc --noEmit