Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit b5c652f

Browse files
dirkmcAlan Shaw
authored and
Alan Shaw
committed
fix: traverse-ipld-graphs (tree) example (#2088)
1 parent 63469ed commit b5c652f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/traverse-ipld-graphs/put.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ createNode((err, ipfs) => {
2020
}
2121
console.log(cid.toBaseEncodedString())
2222
// should print:
23-
// zdpuAzZSktMhXjJu5zneSFrg9ue5rLXKAMC9KLigqhQ7Q7vRm
23+
// bafyreigsccjrxlioppkkzv27se4gxh2aygbxfnsobkaxxqiuni544uk66a
2424
})
2525
})

examples/traverse-ipld-graphs/tree.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ createNode((err, ipfs) => {
2020
let node
2121

2222
try {
23-
dagPB.DAGNode.create(someData)
23+
node = dagPB.DAGNode.create(someData)
2424
} catch (err) {
2525
return cb(err)
2626
}
2727

2828
ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' }, (err, cid) => {
2929
if (err) {
30-
cb(err)
30+
return cb(err)
3131
}
3232
cidPBNode = cid
3333
cb()
@@ -58,5 +58,7 @@ createNode((err, ipfs) => {
5858
console.log(paths)
5959
})
6060
}
61-
])
61+
], (err) => {
62+
console.error('Error:', err)
63+
})
6264
})

0 commit comments

Comments
 (0)