Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<script src="https://unpkg.com/ipfs/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
<script>
(()=>{
const node = new Ipfs();
node.on('ready', () => {
// Your node is now ready to use \o/
console.log('node run');
// stopping a node
node.stop(() => {
// node is now 'offline'
})
})
})();
</script>
Copy link

ghost commented Nov 28, 2017

<script` src="https://unpkg.com/ipfs/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
<script>
const node = new Ipfs({ repo: 'ipfs-' + Math.random() })

node.once('ready', () => {
  console.log('Online status: ', node.isOnline() ? 'online' : 'offline')

})




node.files.cat('QmQzCQn4puG4qu8PVysxZmscmQ5vT1ZXpqo7f58Uh9QfyY', function (err, file) {
if (err) {
throw err
	}

console.log(file.toString('utf8'))
})
</script>

Returns:
"Uncaught TypeError: Cannot read property 'get' of undefined"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment