Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
},
"dependencies": {
"ipfs-core": "0.14.3"
},
"peerDependencies": {
"ipfs-core-types": "^0.10.3"
}
}
5 changes: 3 additions & 2 deletions src/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -130,11 +131,11 @@ function createIPFSInterface(bootstrapNodes: string[], ipfsConfig: Options = def
return Buffer.concat(content).toString();
};

const getJSONData = async <T>(cid: string) => {
const getJSONData = async <T>(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!`);
}
Expand Down