Fix examples

This commit is contained in:
haad
2016-05-18 12:50:36 +02:00
parent 4cfd5367db
commit d26c19adf4
7 changed files with 23627 additions and 11575 deletions

View File

@@ -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);