Add an object to your Helia node and get a CID that refers to the block the object has been stored as.
Optional
options: Partial<AddOptions>import { json } from '@helia/json'
const j = json(helia)
const cid = await str.add({ hello: 'world' })
console.info(cid)
// CID(bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea)
Get an object from your Helia node, either previously added to it or to another node on the network.
Optional
options: Partial<GetOptions>import { json } from '@helia/json'
import { CID } from 'multiformats/cid'
const j = json(helia)
const cid = CID.parse('bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea')
const obj = await j.get(cid)
console.info(obj)
// { hello: 'world' }
Generated using TypeDoc
The JSON interface provides a simple and intuitive way to add/get objects with your Helia node and is a great place to start learning about IPFS.