@didcid/ipfs
v0.1.3
Published
Archon IPFS lib
Readme
Archon IPFS
Archon utilities for integrating with IPFS.
Installation
npm install @didcid/ipfsUsage
basic use
// Import using subpaths
import HeliaClient from '@didcid/ipfs/helia';
// Non-subpath import
import { HeliaClient } from '@didcid/ipfs';
const ipfs = new HeliaClient();
await ipfs.start();
const data = { data: 'whatever' };
const cid = await ipfs.addJSON(data);
const retrieve = await ipfs.getJSON(cid); // retrieve == data
await ipfs.stop();create factory
The static factory method create can be used to create and start an IPFS instance:
const ipfs = await HeliaClient.create();FS blockstore mode
Passing datadir in options to start or create will persist the data to the specified folder.
const ipfs = await HeliaClient.create({ datadir: 'data/ipfs' });minimal mode
Starting IPFS in minimal mode avoids starting a Helia IPFS server.
Only add works to generate CIDs. Nothing is persisted so get always throws a NotConnectedError.
const ipfs = await HeliaClient.create({ minimal: true });