Ipfs.add() is not returning any hash

I started to learn IFPS and below is the code I typed in my terminal to connect to the IPFS network

    > const ipfsClient = require('ipfs-http-client')
    > const ipfs = ipfsClient('https;//ipfs.infura.io:5001')
    > ipfs.add("data",(err,res)=>{console.log("ipfs: ",res)})

I was expecting any hash or error as output but terminal returned
Object [AsyncGenerator] {}

Previously I have tried to implement IPFS through javascript,

onSubmit = (event)=>{
event.preventDefault()
console.log("Submitting...")
console.log(this.state)
ipfs.add(this.state.buffer,(error,result)=>{
  console.log("Working")
  console.log("IPFS Result",result)
  // if(error) {
  //   console.error(error)
  //   return
  // }
})
  }

But on calling onSubmit, no output was shown except the string “Submitting” and the value of the state variable buffer.

It would be very kind if someone help me out with what the problem is.

Hi @neucleophile it appears as though your URL may be incomplete, the add() method is documented here, https://infura.io/docs/ipfs/post/add

Try updating your URL per the format in the docs link and let me know if that helps!