我正在尝试使用提供的远程端点使用 ipfsd-ctl 库从浏览器生成 IPFS 守护程序。
// Start a remote disposable node, and get access to the api
// print the node id, and stop the temporary daemon
const Ctl = require('ipfsd-ctl')
const port = 9090
const server = Ctl.createServer(port, {
ipfsModule: require('ipfs'),
ipfsHttpModule: require('ipfs-http-client')
},
{
js: {
ipfsBin: 'path/js/ipfs/bin'
},
go: {
ipfsBin: 'path/go/ipfs/bin'
},
})
const factory = Ctl.createFactory({
ipfsHttpModule: require('ipfs-http-client'),
remote: true,
endpoint: `http://localhost:${port}` // or you can set process.env.IPFSD_CTL_SERVER to http://localhost:9090
})
await server.start()
const ipfsd = await factory.spawn()
const id = await ipfsd.api.id()
console.log(id)
await ipfsd.stop()
await server.stop()
它显示“服务器未在浏览器中实现”警告和“POST http://localhost:9090/spawn net::ERR_CONNECTION_REFUSED”错误