import toBuffer from 'it-to-buffer' import * as json from 'multiformats/codecs/json' import type { ExporterOptions, ObjectNode, ReadableStorage } from '../index.ts' import type { CID } from 'multiformats/cid' export async function jsonResolver (cid: CID, name: string, path: string, blockstore: ReadableStorage, options?: ExporterOptions): Promise { const block = await toBuffer(blockstore.get(cid, options)) const object = json.decode(block) return { type: 'object', cid, name, path, object, size: BigInt(block.byteLength), node: block } }