0

I'm trying to upload a folder using the ipfs-http-client my code looks like so:

const INFURA_KEY = process.env.REACT_APP_INFURA_PROJECT_ID 
const INFURA_PROJECT_SECRET = process.env.REACT_APP_INFURA_SECRET
const auth ='Basic ' + Buffer.from(INFURA_KEY + ':' + INFURA_PROJECT_SECRET).toString('base64');

const client = create({
    host: 'infura-ipfs.io',
    port: 5001,
    protocol: 'https',
    headers: {
        authorization: auth,
    },
});

for await (const file of client.addAll(globSource(`${imagesDir}/`, '**/*'))) {
    console.log(file)
}

When I try to run this I get an error:

node:internal/deps/undici/undici:11118 Error.captureStackTrace(err, this); ^ DOMException [AbortError]: The operation was aborted. at Object.fetch (node:internal/deps/undici/undici:11118:11)

However if I try to upload a file (in the path) instead of a directory it works.

Ritzy Dev
  • 387
  • 3
  • 10

0 Answers0