Storage backends
Choose Kubo/IPFS or S3-compatible storage with Meshkit.
Meshkit provides two storage backends. Both expose client methods for uploading and retrieving bytes, with capabilities specific to each storage model.
Kubo / IPFS
Use init() for Kubo RPC, optional local daemon startup, multi-node failover, and IPNS. This backend is intended for Node.js and server environments.
import { init } from '@ipfs-meshkit/meshkit';
const { meshkit } = await init({ nodes: ['https://kubo.example.com:5001'] });
const cid = await meshkit.upload(new TextEncoder().encode('hello'));
await meshkit.pin(cid);Kubo supports IPNS methods such as publishName, resolveName, generateKey, and listKeys. It supports listPins() for pinned CIDs; it does not support the S3 list() method.
S3-compatible storage
Use createS3Client() for an S3-compatible endpoint, or createFilOneClient() for the fil.one preset. This backend works in browser and mobile apps and does not require a Kubo daemon.
import { createS3Client } from '@ipfs-meshkit/meshkit';
const storage = createS3Client({
accessKeyId: process.env.STORAGE_KEY!,
secretAccessKey: process.env.STORAGE_SECRET!,
bucket: 'my-bucket',
endpoint: 'https://storage.example.com',
});
const bytes = new TextEncoder().encode('hello');
const cid = await storage.upload(bytes);
const retrieved = await storage.retrieve(cid);
const objects = await storage.list();The CID is computed locally from the original bytes and used as the object key in your bucket. It is not published to the IPFS network. Keep the CID in your application if you need to retrieve the object later.
The computed key uses a CIDv1 raw identifier with a SHA-256 digest. The fil.one preset defaults to https://eu-west-1.s3.fil.one; get credentials and create a bucket in the fil.one dashboard. Pass an explicit endpoint to createS3Client() for other S3-compatible providers.
Keep S3 credentials out of public source control. Any credentials bundled into a browser or mobile app can be extracted by its users; use appropriately restricted credentials or a server-side proxy for sensitive buckets.
S3 clients support upload, retrieve, list, listPins, pin, and healthCheck. pin() is a no-op because object storage has no IPFS pinning layer. IPNS operations are unsupported and throw MeshkitError.
import { createFilOneClient } from '@ipfs-meshkit/meshkit';
const storage = createFilOneClient({
accessKeyId: process.env.FIL_ACCESS_KEY!,
secretAccessKey: process.env.FIL_SECRET_KEY!,
bucket: 'my-bucket',
});list() returns { cid, size, uploadedAt }[] and handles pagination; listPins() returns only CID strings. Both list the contents of the configured bucket.
Shared client-side encryption
Both backends support the same encryption options for upload and retrieval. Encryption happens in the client before bytes are sent to the storage backend.