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

Commit 254afdc

Browse files
committed
feat: migrate core to use new async DAGNode interface
1 parent 5dbb799 commit 254afdc

File tree

4 files changed

+132
-88
lines changed

4 files changed

+132
-88
lines changed

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@
4040
},
4141
"homepage": "https://github.com./ipfs/js-ipfs#readme",
4242
"devDependencies": {
43-
"aegir": "^8.0.1",
43+
"aegir": "^8.1.2",
4444
"buffer-loader": "0.0.1",
4545
"chai": "^3.5.0",
4646
"execa": "^0.5.0",
4747
"expose-loader": "^0.7.1",
4848
"form-data": "^2.0.0",
4949
"fs-pull-blob-store": "^0.4.1",
5050
"gulp": "^3.9.1",
51-
"interface-ipfs-core": "^0.15.0",
51+
"interface-ipfs-core": "^0.16.6",
5252
"left-pad": "^1.1.1",
5353
"lodash": "^4.15.0",
5454
"ncp": "^2.0.0",
@@ -70,14 +70,15 @@
7070
"glob": "^7.0.6",
7171
"hapi": "^15.0.3",
7272
"idb-pull-blob-store": "^0.5.1",
73-
"ipfs-api": "^9.0.0",
73+
"ipfs-api": "^10.0.0",
7474
"ipfs-bitswap": "^0.7.0",
7575
"ipfs-block": "^0.4.0",
7676
"ipfs-block-service": "^0.6.0",
7777
"ipfs-multipart": "^0.1.0",
7878
"ipfs-repo": "^0.10.0",
7979
"ipfs-unixfs": "^0.1.4",
80-
"ipfs-unixfs-engine": "^0.11.3",
80+
"ipfs-unixfs-engine": "^0.12.0",
81+
"ipld-resolver": "^0.1.1",
8182
"isstream": "^0.1.2",
8283
"joi": "^9.0.4",
8384
"libp2p-ipfs": "^0.14.1",
@@ -97,7 +98,7 @@
9798
"peer-id": "^0.7.0",
9899
"peer-info": "^0.7.1",
99100
"promisify-es6": "^1.0.1",
100-
"pull-file": "^1.1ed.0",
101+
"pull-file": "^1.0.0",
101102
"pull-paramap": "^1.1.6",
102103
"pull-pushable": "^2.0.1",
103104
"pull-sort": "^1.0.0",

src/core/components/files.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = function files (self) {
3232

3333
add: promisify((data, callback) => {
3434
if (!callback || typeof callback !== 'function') {
35-
callback = function noop () {}
35+
callback = noop
3636
}
3737

3838
pull(
@@ -97,17 +97,22 @@ module.exports = function files (self) {
9797
}
9898
}
9999

100-
function prepareFile (self, file, cb) {
100+
function prepareFile (self, file, callback) {
101101
const bs58mh = multihashes.toB58String(file.multihash)
102102
self.object.get(file.multihash, (err, node) => {
103103
if (err) {
104-
return cb(err)
104+
return callback(err)
105105
}
106106

107-
cb(null, {
108-
path: file.path || bs58mh,
109-
hash: bs58mh,
110-
size: node.size()
107+
node.size((err, size) => {
108+
if (err) {
109+
return callback(err)
110+
}
111+
callback(null, {
112+
path: file.path || bs58mh,
113+
hash: bs58mh,
114+
size: size
115+
})
111116
})
112117
})
113118
}
@@ -147,3 +152,5 @@ function normalizeContent (content) {
147152
return data
148153
})
149154
}
155+
156+
function noop () {}

0 commit comments

Comments
 (0)