Compare commits
2 Commits
3955ff2c29
...
4dd54a4f8b
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 4dd54a4f8b | |
Derrick Hammer | 3ba792cd35 |
11
src/index.ts
11
src/index.ts
|
@ -64,6 +64,7 @@ BigInt.prototype.toJSON = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
addHandler("presentSeed", handlePresentSeed);
|
addHandler("presentSeed", handlePresentSeed);
|
||||||
|
addHandler("ready", handleReady);
|
||||||
addHandler("stat", handleStat);
|
addHandler("stat", handleStat);
|
||||||
addHandler("ls", handleLs, { receiveUpdates: true });
|
addHandler("ls", handleLs, { receiveUpdates: true });
|
||||||
addHandler("cat", handleCat, { receiveUpdates: true });
|
addHandler("cat", handleCat, { receiveUpdates: true });
|
||||||
|
@ -220,6 +221,12 @@ async function handlePresentSeed() {
|
||||||
moduleDefer.resolve();
|
moduleDefer.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handleReady(aq: ActiveQuery) {
|
||||||
|
await ready();
|
||||||
|
|
||||||
|
aq.respond();
|
||||||
|
}
|
||||||
|
|
||||||
async function handleStat(aq: ActiveQuery) {
|
async function handleStat(aq: ActiveQuery) {
|
||||||
await ready();
|
await ready();
|
||||||
|
|
||||||
|
@ -339,6 +346,10 @@ async function handleIpnsResolve(aq: ActiveQuery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCID(cid: string): CID {
|
function getCID(cid: string): CID {
|
||||||
|
try {
|
||||||
|
return CID.parse(cid);
|
||||||
|
} catch {}
|
||||||
|
|
||||||
const prefix = substr(cid, 0, 1);
|
const prefix = substr(cid, 0, 1);
|
||||||
|
|
||||||
if (!(prefix in basesByPrefix)) {
|
if (!(prefix in basesByPrefix)) {
|
||||||
|
|
Loading…
Reference in New Issue