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