Skip to content

Blobs

A blob is an opaque binary object stored on the node — an application bundle, or arbitrary app data. sdk.admin covers the full lifecycle.

Pass raw bytes (Uint8Array, ArrayBuffer, or Blob). Optionally scope the blob to a context and supply an integrity hash:

const bytes = new Uint8Array(await file.arrayBuffer());
const { blobId } = await sdk.admin.uploadBlob({
data: bytes,
hash: '…', // optional
contextId: 'ctx-id', // optional — announce to a context
});

The body is sent as application/octet-stream to PUT /admin-api/blobs.

Passing contextId announces the blob to that context’s availability nodes, so its other members can later discover it. Without it the blob stays local to this node.

const { blobs } = await sdk.admin.listBlobs();
// blobs: { blobId, size }[]

getBlobInfo issues a HEAD request — it reads size, hash, and MIME type from the response headers without transferring the body:

const info = await sdk.admin.getBlobInfo(blobId);
// { blobId, size, hash?, mimeType?, source? }

getBlob returns the raw bytes as an ArrayBuffer — the endpoint streams the blob content (e.g. application/gzip), not JSON.

const buffer = await sdk.admin.getBlob(blobId); // ArrayBuffer
const view = new Uint8Array(buffer);

Both reads take an optional context. Without one the node answers from its own store or 404s. With one it discovers the blob on the network — probing the context’s peers, availability nodes first — and then transfers it:

const buffer = await sdk.admin.getBlob(blobId, { contextId: 'ctx-id' });
const info = await sdk.admin.getBlobInfo(blobId, { contextId: 'ctx-id' });

A getBlobInfo answered by a peer probe carries only presence and size, so hash and mimeType are absent; source says which side answered ('local' or 'peer') on nodes that report it.

const { blobId: deletedId, deleted } = await sdk.admin.deleteBlob(blobId);