index ↓
blob
client.blobrequests
you ask, the daemon answers. await the tagged result and check .ok
list(): Promise<TypedRequestResult<BlobListReply, never>>
push form: onList (subscribe instead of awaiting)
const res = await client.blob.list();
if (res.ok) {
console.log(res.response.entries);
}type Result =
| { ok: true; response: BlobListReply }
| { ok: false; kind: 'domain'; error: never }
| { ok: false; kind: 'protocol'; error: WireError };events
the daemon pushes these unprompted. subscribing returns an unsubscribe function
onChanged(handler: (BlobChanged) => void): () => void
const off = client.blob.onChanged((blobChanged) => {
console.log(blobChanged.key);
});
// call off() to unsubscribetypes
shapes referenced above, as the sdk types them
type BlobChanged = {
key: string;
sha256?: string;
url?: string;
};type BlobListReply = {
entries: BlobEntry[];
};type BlobEntry = {
key: string;
sha256: string;
mime: string;
size: number;
url: string;
};