Hello,
I am new learner to IPFS so I have already installed IPFS. in my sample project I am trying to create an instance of ipfs in nodejs but not able to work.
below is my code where I am stucking
const IPFS = require(‘ipfs’)
const node = new IPFS()
node.on(‘ready’, async () => {
const version = await node.version()
console.log(‘Version:’, version.version)
const filesAdded = await node.add({
path: ‘hello.txt’,
content: Buffer.from(‘Hello World 101’)
})
console.log(‘Added file:’, filesAdded[0].path, filesAdded[0].hash)
const fileBuffer = await node.cat(filesAdded[0].hash)
console.log(‘Added file contents:’, fileBuffer.toString())
})
After executing this code in nodejs. I am getting an error : Error: Cannot find module ‘ipfs’. Please provide me some assistance.
Regards
Nishant