From f6d1c7dbafbcb5f458ad47aa0492f4555dcf988e Mon Sep 17 00:00:00 2001 From: Hayden Young Date: Tue, 19 Mar 2024 23:55:16 +0000 Subject: [PATCH] docs: Randomize blockstore location. --- docs/GETTING_STARTED.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md index 763bd97..7944815 100644 --- a/docs/GETTING_STARTED.md +++ b/docs/GETTING_STARTED.md @@ -27,7 +27,7 @@ then instantiate and pass to Helia: ``` import { LevelBlockstore } from 'blockstore-level' -const blockstore = new LevelBlockstore('./ipfs') +const blockstore = new LevelBlockstore('./ipfs/blocks') const ipfs = createHelia({ blockstore }) ``` @@ -117,7 +117,7 @@ import { LevelBlockstore } from 'blockstore-level' import { Libp2pOptions } from './config/libp2p.js' // Create an IPFS instance. -const blockstore = new LevelBlockstore('./ipfs') +const blockstore = new LevelBlockstore('./ipfs/blocks') const libp2p = await createLibp2p(Libp2pOptions) const ipfs = await createHelia({ libp2p, blockstore }) @@ -207,13 +207,13 @@ import { createOrbitDB, IPFSAccessController } from '@orbitdb/core' import { LevelBlockstore } from 'blockstore-level' import { Libp2pOptions } from './config/libp2p.js' -const main = async () => { - const blockstore = new LevelBlockstore('./ipfs') - const libp2p = await createLibp2p(Libp2pOptions) - const ipfs = await createHelia({ libp2p, blockstore }) - +const main = async () => { // create a random directory to avoid OrbitDB conflicts. let randDir = (Math.random() + 1).toString(36).substring(2) + + const blockstore = new LevelBlockstore(`./${randDir}/ipfs/blocks`) + const libp2p = await createLibp2p(Libp2pOptions) + const ipfs = await createHelia({ libp2p, blockstore }) const orbitdb = await createOrbitDB({ ipfs, directory: `./${randDir}/orbitdb` })