helia-ipfs-node
v1.0.11
Published
## Description. A helia ipfs node for upload files and sharing it beetwen nodes.
Downloads
236
Readme
IPFS node.
Description.
A helia ipfs node for upload files and sharing it beetwen nodes.
Usage
Instantiate a node.
import { HeliaNode } from '../src/lib.js'
const node = new HeliaNode({ storePath: 'my/store/path' })
await node.start()
console.log('node started!')
Instantiate a gateway.
import { Server } from '../src/lib.js'
const gateway = new Server({ node, port: 8080 })
await gateway.start()
Connections.
import { HeliaNode } from '../src/lib.js'
const node1 = new HeliaNode()
await node1.start()
console.log('node1 started!')
const node2 = new HeliaNode({ wsPort: 4011 , tcpPort: 4012, 'my-store-path' })
await node2.start()
console.log('node2 started!')
const node1Addrs = await node1.getMultiAddress()
await node2.connect(node1Addrs[0])
console.log('connected nodes!')