1

Now I am trying to create new directory to ipfs by using "ipfs-http-client"? const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64') const ipfs = new ipfsAPI({ host: 'ipfs.infura.io', port: 5001, protocol: 'https', headers: { authorization: auth } }); ipfs.files.mkdir("/myfolder");

but I have got error."ipfs method not supported". Did anyone see that in the past?

1 Answer 1

2

It looks like you were trying to use some outdated version of the module, try this code, it worked for me:

import { create } from 'ipfs-http-client'
const auth = 'Basic' + Buffer.from('projectId' + ':' + 'secret').toString('base64');
const ipfs = create({host: 'ipfs.infura.io', port: 5001, protocol: 'https', headers: { authorization: auth } });
let result = await ipfs.files.mkdir("/myfolder");
5
  • 1
    that is not working
    – pongpong
    Dec 22, 2021 at 18:29
  • @pongpong what error do you get?
    – MimoKrok
    Dec 27, 2021 at 9:14
  • @MimoKrok I used your suggestion and I am also getting "ipfs method not supported." I am using ^55.0.0 for the library. Do you have any debugging suggestions? ipfs.add and ipfs.cat are working.
    – dlsso
    Jan 7, 2022 at 17:38
  • 1
    @MimoKrok this post says Infura does not support MFS. Looks like that may be the problem. Were you using a different host by chance?
    – dlsso
    Jan 7, 2022 at 18:07
  • No, not really, the code I posted is exactly the one I used
    – MimoKrok
    Jan 12, 2022 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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