碱基编码:不支持所选编码"/>
IPFS:HTTPError:URL arg 必须是多碱基编码:不支持所选编码
我想用本地运行的 IPFS 守护进程创建一个 OrbitDB 数据库。
我的代码基于 在过去的讨论中发布的代码示例,并进行了一些更改。
这是我的代码(test.js):
import * as IpfsClient from 'ipfs-http-client'
import OrbitDB from 'orbit-db'
const ipfs = IpfsClient.create('/ip4/127.0.0.1/tcp/5001')
const orbitdb = await OrbitDB.createInstance(ipfs)
const db = await orbitdb.eventlog('mydatabase')
我通过
ipfs daemon
启动了IPFS守护进程。
当我使用
node test.js
运行我的代码时,它在最后一行失败。我收到以下错误:
/home/me/node_modules/ipfs-http-client/src/lib/core.js:100
let error = new HTTP.HTTPError(response)
^
HTTPError: URL arg must be multibase encoded: selected encoding not supported
at Object.errorHandler [as handleError] (/home/me/node_modules/ipfs-http-client/src/lib/core.js:100:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.fetch (/home/me/node_modules/ipfs-http-client/node_modules/ipfs-utils/src/http.js:145:9) {
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: true,
ended: true,
endEmitted: true,
reading: false,
constructed: true,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: true,
errored: null,
closed: true,
closeEmitted: true,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
error: [ [Function (anonymous)], [Function (anonymous)] ],
data: [Function (anonymous)],
end: [Function (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: true,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: true,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: true,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: true,
closeEmitted: true,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: true,
error: null
},
[Symbol(Response internals)]: {
url: 'http://127.0.0.1:5001/api/v0/pubsub/sub?arg=%2Forbitdb%2F.............%2Fmydatabase',
status: 500,
statusText: 'Internal Server Error',
headers: Headers {
[Symbol(map)]: [Object: null prototype] {
'access-control-allow-headers': [ 'X-Stream-Output, X-Chunked-Output, X-Content-Length' ],
'access-control-expose-headers': [ 'X-Stream-Output, X-Chunked-Output, X-Content-Length' ],
'content-type': [ 'application/json' ],
server: [ 'kubo/0.16.0' ],
trailer: [ 'X-Stream-Error' ],
vary: [ 'Origin' ],
date: [ 'Thu, 01 May 2023 01:00:00 GMT' ],
'transfer-encoding': [ 'chunked' ]
}
},
counter: 0
}
}
}
我不确定,但在我看来 IPFS 守护进程不允许我创建数据库(或通常是文件)。这里缺少什么?我该如何解决这个问题?
回答如下:更多推荐
IPFS:HTTPError:URL arg 必须是多碱基编码:不支持所选编码
发布评论