Data API Demo — Hypercore, Hyperbee, Hyperdrive, Autobase, Hyperdb
What this example does
Uses the native host Data API via BridgeSwarm.request(type, payload): Hypercore (info, append, get), Hyperbee (put/get/del), Hyperdrive (put/get/list), Autobase (append, info, view), and Hyperdb (insert/get/delete/find/flush on the records collection). Single tab; no P2P connections required for basic operations.
Prerequisites
Install the BridgeSwarm extension and native host before opening this example.
How to run
npm run examples
Open http://127.0.0.1:4173/data-demo/. Do not use file://.
Usage
- Open the page; the log shows “Data API ready” when the extension is available.
- Use the buttons to run each command: Core info, Append; Put / Get / Del for Hyperbee; Put / Get / List / for Hyperdrive; Append / Info / Read view (0..4) for Autobase; Put / Get / Del / Find all / Flush for Hyperdb (records).
- The log shows request results and errors.
Files in this directory
- index.html — Page structure (sections and buttons per API, log).
- style.css — Layout and theme (sections, rows, log).
- app.js — BridgeSwarm.ready(), BridgeSwarm.request() for each command type, log output.
APIs and concepts
BridgeSwarm.ready()— Wait for the injected API.BridgeSwarm.request(type, payload)— Send a command to the host. Types used:- Hypercore:
coreInfo,coreAppend,coreGet - Hyperbee:
beeGet,beePut,beeDel - Hyperdrive:
driveGet,drivePut,driveList - Autobase:
autobaseAppend,autobaseInfo,autobaseViewGet - Hyperdb:
hyperdbInsert,hyperdbGet,hyperdbDelete,hyperdbFindToArray,hyperdbFlush(collectionrecords)
- Hypercore:
Responses are { ok, ... } or { ok: false, error }; binary data is base64 in payloads.
See also
- Data API reference — Full command list and examples.
- API reference — Host request types and events.