Created
July 27, 2016 13:59
-
-
Save daviddias/9aa8055c72dd654b5640517a81db8bed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const IPFS = require('ipfs') | |
const os = require('os') | |
const repoPath = os.tmpdir() + '/' + Math.random() | |
const node = new IPFS(repoPath) | |
node.init({}, (err) => { | |
if (err) { throw err } | |
node._repo.config.get((err, config) => { | |
if (err) { throw err } | |
config.Addresses = { | |
Swarm: [ | |
'/ip4/127.0.0.1/tcp/10000', | |
'/ip4/127.0.0.1/tcp/20000/ws' | |
], | |
API: '', | |
Gateway: '' | |
} | |
node._repo.config.set(config, (err) => { | |
if (err) { throw err } | |
node.load((err) => { | |
if (err) { throw err } | |
node.goOnline((err) => { | |
if (err) { throw err } | |
console.log('Node is online') | |
}) | |
}) | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment