ipfs
Version:
JavaScript implementation of the IPFS specification
20 lines (14 loc) • 375 B
JavaScript
const print = require('../../utils').print
module.exports = {
command: 'sub <topic>',
describe: 'Subscribe to a topic',
builder: {},
handler (argv) {
argv.resolve((async () => {
const handler = msg => print(msg.data.toString())
const ipfs = await argv.getIpfs()
await ipfs.pubsub.subscribe(argv.topic, handler)
})())
}
}