IPFSCache

Source IPFSCache

IPFSCache

IPFS cache that uses an index db to store ipfs results in. Will be passed to the blockchain-core for automated caching.


constructor

new IPFSCache();

IPFS cache that uses an index db to store ipfs results in.

Returns

IPFSCache instance

Example

const ipfsCache = new IPFSCache();

get

ipfsCache.get(hash);

gets an cached ipfs result

Parameters

  1. hash - string: ipfs hash to load the data from

Returns

Promise returns string: ipfs result


add

ipfsCache.add(hash, data);

adds a ipfs value into the idb store cache

Parameters

  1. hash - string: ipfs hash to store the data for
  2. data - any: data to store for the ipfs hash

Returns

Promise returns void: resolved when done