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,8 +95,11 @@ const OrbitDB = require('orbit-db')
// Create IPFS instance
var ipfs;
const initIPFSInstance = async () => {
// For js-ipfs >= 0.38
const ipfs = new IPFS()
ipfs = await IPFS.create({ repo: "./path-for-js-ipfs-repo" });
// For js-ipfs < 0.38
const ipfsOptions = {
@ -104,7 +107,10 @@ const ipfsOptions = {
pubsub: true
}
}
const ipfs = new IPFS(ipfsOptions)
ipfs = new IPFS(ipfsOptions)
}
initIPFSInstance()
ipfs.on('error', (e) => console.error(e))
ipfs.on('ready', async () => {