0

I want to upload a directory to ipfs on my browser using (js-ipfs-http-client) module. I found this old issue. https://github.com/ipfs/js-ipfs/issues/277 So I decided to use recursive way to add files and get only one hash for it.

ipfs.addFromFs('path', { recursive: true, ignore: ['subfolder/to/ignore/**'] }, (err, result) => {
            if (err) { throw err }
            console.log(result)
        })

But it gave me this error.

enter image description here

I need to upload a directory to ipfs using javascript but all resources I had found upload only one file.Or a lot of files with array of hashes. I need a way to upload all files of directory and get the with only one hash. Thanks in advance.

0

I think the issue is that you're trying to call functions from the fs module client-side rather than server-side.

  • I know but it's required to use solidity only on the backend. And js will used for fronted. I had already used cdn for fs module and it's working. – yehia tarek Aug 11 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.