fix: fix documentation

fixed initialization snippet for `ipfs` module
This commit is contained in:
vasa 2020-03-24 20:33:28 +05:30 committed by Mark Robert Henderson
parent 5f7f20e621
commit 2c9dd9480d

View File

@ -95,16 +95,22 @@ const OrbitDB = require('orbit-db')
// Create IPFS instance
// For js-ipfs >= 0.38
const ipfs = new IPFS()
var ipfs;
// For js-ipfs < 0.38
const ipfsOptions = {
EXPERIMENTAL: {
pubsub: true
const initIPFSInstance = async () => {
// For js-ipfs >= 0.38
ipfs = await IPFS.create({ repo: "./path-for-js-ipfs-repo" });
// For js-ipfs < 0.38
const ipfsOptions = {
EXPERIMENTAL: {
pubsub: true
}
}
ipfs = new IPFS(ipfsOptions)
}
const ipfs = new IPFS(ipfsOptions)
initIPFSInstance()
ipfs.on('error', (e) => console.error(e))
ipfs.on('ready', async () => {