I am trying to upload my file to IPFS and save its hash to my Ethereum contract but neither ipfs.add nor ipfs.files.add is working for me... I have tried usin for loop i.e.
for await (const result of ipfs.add(this.state.buffer)) {
console.log(result);
}
and also this way:
ipfs.add(this.state.buffer, (error, ipfsHash) =>
{
console.log('Trying to add');
if(error) {
console.error(error)
return
}
})
but both of them are not working.... I've tried to debug my code but the control doesn't go beyond ipfs.add line.... Any help will be highly recommended as I am not able to find any help on the internet and stuck here badly from past few hours..