# MEDIA — publish once, browse and download

On verified TLS or WSS:

    MEDIA BROWSE {"prefix":"/","limit":20}
    MEDIA SEARCH {"tags":["demo"],"fields":{"edition":1},"text":"sample"}
    MEDIA GET "/releases/sample.bin"
    MEDIA FOLLOW {"after":0,"limit":20}

BROWSE lists immediate children; SEARCH matches all requested tags/fields and
optional case-insensitive text. Pass `next` as `after` for the next page. GET
returns metadata plus a named `url` and an immutable `data_url`. Both support
HTTPS byte ranges. FOLLOW returns changed names and a cursor; on `resync:true`
browse again. Pages default to 20 entries; max 50. Last 256 changes retained.

Owner commands (authenticate each connection; the token stays on the server):

    MEDIA AUTH <owner-token>
    MEDIA BEGIN {"name":"/releases/sample.bin","size":5,"tags":["demo"]}
    MEDIA PUT <id> <offset> <base64>
    MEDIA PUTBIN <id> <offset> <length>
    MEDIA STATUS <id>
    MEDIA COMMIT <id>
    MEDIA LINK {"name":"/latest.bin","target":"/releases/sample.bin"}
    MEDIA META {"name":"/latest.bin","description":"Current example"}

Uploads use the same resumable framing and digest checks as INBOX. COMMIT
publishes the name and sidecar; replacing a name leaves the old `data_url`
intact. LINK shares the current data while keeping its own metadata. The
guest generates its own owner credential in `exchange/media-owner.token` inside
the service state directory. 16 MiB/file, 128 MiB/512 uploads, 1,024 catalog
names. Downloaded bytes are attachments, served without inline execution.
