Hello,
I’m very much an intermediate coder, so please keep that in mind when offering any potential help. I’m trying to use js-ipfs to both simply add a file via my infura, which it does successfully, then use name publish, which is giving me an error. Any help would be greatly appreciated.
The error message that I get is “Uncaught HTTPError HTTPError: ipfs method not supported.”
import { create } from 'ipfs-http-client';
import fs from 'fs';
const infuraId = "<my ID>";
const infuraSecret = "<my secret>";
const auth =
`Basic ${Buffer.from(infuraId + ':' + infuraSecret).toString('base64')}`;
const client = create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
headers: {
authorization: auth,
},
});
try {
fs.readFile("NodejsConsoleApp1/index.html", (error, data) => {
if(error) throw error;
client.add(data).then((res) => {
client.name.publish(res.path).then(value => {
console.log(`https://gateway.ipfs.io/ipns/${value.name}`);
})
});
});
} catch (error) {
}