尝试使用 infura 创建目录。这是来自文档,但它不起作用......
const run = async () => {
const projectId = 'xxx';
const projectSecret = 'xxx';
const auth =
'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64');
const ipfsClient = require('ipfs-http-client');
const client = ipfsClient.create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
headers: {
authorization: auth,
},
});
var dir = await client.files.mkdir('/example')
console.log(dir);
// LOG: ipfs method not supported
}
使用 curl 也不起作用
curl -X POST -u "xxx:xxx" "https://ipfs.infura.io:5001/api/v0/files/mkdir?arg=/ipfs-examples-dir"
// LOG: ipfs method not supported
我错过了什么或做错了什么?