diff --git a/package.json b/package.json index c0151d1..bb4271a 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,8 @@ }, "dependencies": { "ipfs-core": "0.14.3" + }, + "peerDependencies": { + "ipfs-core-types": "^0.10.3" } } diff --git a/src/ipfs.ts b/src/ipfs.ts index eded781..1c15e86 100644 --- a/src/ipfs.ts +++ b/src/ipfs.ts @@ -15,6 +15,7 @@ * */ import type { Options, IPFS, CID } from 'ipfs-core'; +import type { GetOptions } from 'ipfs-core-types/types/src/dag'; import { IPFSInterface } from './types'; const defaultIpfsConfig: Options = { @@ -130,11 +131,11 @@ function createIPFSInterface(bootstrapNodes: string[], ipfsConfig: Options = def return Buffer.concat(content).toString(); }; - const getJSONData = async (cid: string) => { + const getJSONData = async (cid: string, options?: GetOptions) => { if (!node || !CIDClass) { throw new Error(`Not initialised!`); } - const res = await node.dag.get(CIDClass.parse(cid)); + const res = await node.dag.get(CIDClass.parse(cid), options); if (!res.value) { throw new Error(`No data found!`); }