Low-level client
createMeshkitClient — single-node RPC client without failover.
For cases where you want direct control over a single Kubo node — scripts, testing, or environments where you manage failover yourself — use createMeshkitClient.
createMeshkitClient
import { createMeshkitClient } from '@ipfs-meshkit/meshkit';
const client = createMeshkitClient(config: MeshkitConfig): MeshkitClientReturns a MeshkitClient bound to a single Kubo node. No health check, no failover.
MeshkitConfig
| Property | Type | Description |
|---|---|---|
apiUrl | string | Kubo RPC API URL, e.g. http://127.0.0.1:5001. |
headers | Record<string, string> | Optional request headers (auth). |
Example
import { createMeshkitClient } from '@ipfs-meshkit/meshkit';
const client = createMeshkitClient({
apiUrl: 'http://127.0.0.1:5001',
headers: { Authorization: 'Bearer token' },
});
const cid = await client.upload(new TextEncoder().encode('hello'));
const bytes = await client.retrieve(cid);MeshkitClient interface
MeshkitClient has the same method signatures as Meshkit, but operates on a single node with no failover:
| Method | Description |
|---|---|
upload(data: Uint8Array) | Upload bytes; returns CID. |
retrieve(cid: string) | Retrieve by CID. |
pin(cid: string) | Pin a CID. |
listPins() | List pinned CIDs. |
publishName(value, options?) | Publish IPNS record. |
resolveName(name, options?) | Resolve IPNS name. |
resolveAndRetrieve(name, options?) | Resolve and retrieve. |
generateKey(name, options?) | Create IPNS signing key. |
listKeys() | List keystore. |
healthCheck() | Confirm the RPC API is reachable. Throws if not. |
The healthCheck() method is unique to MeshkitClient — the Meshkit facade runs health checks internally at init() time.