Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

jsipfs : how to use exist node in node.js #953

Closed
kappabooom opened this issue Aug 20, 2017 · 6 comments
Closed

jsipfs : how to use exist node in node.js #953

kappabooom opened this issue Aug 20, 2017 · 6 comments

Comments

@kappabooom
Copy link

  • Version: 0.25.1
  • Platform: mac osX
  • Subsystem:

Type: question

Severity: medium

Description:

when I run node.js , the function
(const node = new IPFS({
init: true,
start: true,
repo: repoPath)}
)
will produce the new node again, hence I can't change the config in this node, because I don't know how to use the node I had produced.

Steps to reproduce the error:

@daviddias
Copy link
Member

Hi @kappabooom, you are telling the node to "init the repo" again with the option "init: true". You can get your issue solved and simplified by just having:

const node = new IPFS({
  repo: repoPath
})

@kappabooom
Copy link
Author

@diasdavid Thanks for your answer~ but I got some troubles on use 'repoPath' , it will appear error " Error: repo already exists", when I run the code:

const repoPath = 'test';
const node = new IPFS({ repo: repoPath, });

@daviddias
Copy link
Member

Right. My bad, that is because it defaults to init the repo. Do:

const node = new IPFS({
  init: false,
  repo: repoPath
})

On the second time

@kappabooom
Copy link
Author

@diasdavid Yes, I solved this problem. Thank you very much!!!

@daviddias
Copy link
Member

wooot @kappabooom :D

@mitra42
Copy link

mitra42 commented Aug 25, 2017

Is there a way to tell it to init the repo if it hasn't already been inited, and not otherwise ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants