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

Commit

Permalink
refactor: update ipld formats, async/await mfs/unixfs & base32 cids (…
Browse files Browse the repository at this point in the history
…#2068)

This is part of the Awesome Endeavour: Async Iterators: ipfs/js-ipfs#1670

Depends on

* [x] ipld/js-ipld-dag-pb#137
* [x] ipfs-inactive/interface-js-ipfs-core#473
* [x] ipfs-inactive/js-ipfs-http-client#1010
* [x] ipfs/js-ipfs-http-response#25

resolves #1995

BREAKING CHANGE: The default string encoding for version 1 CIDs has changed to `base32`.

IPLD formats have been updated to the latest versions. IPLD nodes returned by `ipfs.dag` and `ipfs.object` commands have significant breaking changes. If you are using these commands in your application you are likely to encounter the following changes to `dag-pb` nodes (the default node type that IPFS creates):

* `DAGNode` properties have been renamed as follows:
    * `data` => `Data`
    * `links` => `Links`
    * `size` => `size` (Note: no change)
* `DAGLink` properties have been renamed as follows:
    * `cid` => `Hash`
    * `name` => `Name`
    * `size` => `Tsize`

See CHANGELOGs for each IPLD format for it's respective changes, you can read more about the [`dag-pb` changes in the CHANGELOG](https://github.com/ipld/js-ipld-dag-pb/blob/master)

License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
achingbrain authored and Alan Shaw committed May 21, 2019
1 parent 71b4f4c commit d27c003
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 10 additions & 9 deletions traverse-ipld-graphs/get-path-accross-formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ createNode((err, ipfs) => {
series([
(cb) => {
const someData = Buffer.from('capoeira')
let node

dagPB.DAGNode.create(someData, (err, node) => {
try {
node = dagPB.DAGNode.create(someData)
} catch (err) {
return cb(err)
}

ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' }, (err, cid) => {
if (err) {
cb(err)
}

ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' }, (err, cid) => {
if (err) {
cb(err)
}
cidPBNode = cid
cb()
})
cidPBNode = cid
cb()
})
},
(cb) => {
Expand Down
19 changes: 10 additions & 9 deletions traverse-ipld-graphs/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ createNode((err, ipfs) => {
series([
(cb) => {
const someData = Buffer.from('capoeira')
let node

dagPB.DAGNode.create(someData, (err, node) => {
try {
dagPB.DAGNode.create(someData)
} catch (err) {
return cb(err)
}

ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' }, (err, cid) => {
if (err) {
cb(err)
}

ipfs.dag.put(node, { format: 'dag-pb', hashAlg: 'sha2-256' }, (err, cid) => {
if (err) {
cb(err)
}
cidPBNode = cid
cb()
})
cidPBNode = cid
cb()
})
},
(cb) => {
Expand Down

0 comments on commit d27c003

Please sign in to comment.