mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-10-07 22:57:07 +00:00
Fix examples
This commit is contained in:
@@ -171665,7 +171665,7 @@
|
||||
if (!ipfs) throw new Error("Ipfs instance not defined");
|
||||
if (!hash) throw new Error("Invalid hash: " + hash);
|
||||
return ipfs.object.get(hash, { enc: 'base58' }).then(function (res) {
|
||||
console.log("RES", res);
|
||||
// console.log("RES", res)
|
||||
return Log.fromJson(ipfs, JSON.parse(res.toJSON().Data));
|
||||
});
|
||||
}
|
||||
@@ -171772,9 +171772,16 @@
|
||||
value: function fromIpfsHash(ipfs, hash) {
|
||||
if (!ipfs) throw new Error("Node requires ipfs instance");
|
||||
if (!hash) throw new Error("Invalid hash: " + hash);
|
||||
console.log(hash);
|
||||
return ipfs.object.get(hash, { enc: 'base58' }).then(function (obj) {
|
||||
var f = JSON.parse(obj.toJSON().Data);
|
||||
var f = void 0;
|
||||
try {
|
||||
f = JSON.parse(obj.toJSON().Data);
|
||||
} catch (e) {
|
||||
console.log("--------------");
|
||||
console.log(e);
|
||||
console.log(obj.toJSON());
|
||||
}
|
||||
// const f = JSON.parse(obj.toJSON().Data)
|
||||
return Node.create(ipfs, f.payload, f.next);
|
||||
});
|
||||
}
|
||||
@@ -171838,7 +171845,7 @@
|
||||
logger.debug("---------------------------------------------------");
|
||||
console.log('\n');
|
||||
}).catch(function (e) {
|
||||
return logger.error(e);
|
||||
return logger.error(e.stack);
|
||||
});
|
||||
};
|
||||
setInterval(query, 1000);
|
||||
|
||||
Reference in New Issue
Block a user