Skip to content

Commit 3fa63e3

Browse files
authoredAug 29, 2018
fix: fix ipfsd.init return value (#291)
init should return ipfsd instance in the callback but didn't closes #289
1 parent 5de0ada commit 3fa63e3

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Initialize a repo.
201201
- `directory` (default IPFS_PATH if defined, or ~/.ipfs for go-ipfs and ~/.jsipfs for js-ipfs) - The location of the repo.
202202
- `pass` (optional) - The passphrase of the key chain.
203203

204-
`callback` is a function with the signature `function (Error, ipfsd)` where `err` is an Error in case something goes wrong and `ipfsd` is the daemon controller instance.
204+
`callback` is a function with the signature `function (err, ipfsd)` where `err` is an Error in case something goes wrong and `ipfsd` is the daemon controller instance.
205205

206206
#### `ipfsd.cleanup(callback)`
207207

@@ -215,7 +215,7 @@ Start the daemon.
215215

216216
`flags` - Flags array to be passed to the `ipfs daemon` command.
217217

218-
`callback` is a function with the signature `function(err, ipfsApi)` that receives an instance of `ipfs-api` on success or an instance of `Error` on failure
218+
`callback` is a function with the signature `function(err, ipfsApi)` that receives an instance of `Error` on failure or an instance of `ipfs-api` on success.
219219

220220

221221
#### `ipfsd.stop([timeout, callback])`

‎src/ipfsd-client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class DaemonClient {
9595
}
9696

9797
this.initialized = res.body.initialized
98-
cb()
98+
cb(null, this)
9999
})
100100
}
101101

‎src/ipfsd-daemon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class Daemon {
187187
if (err) { return callback(err) }
188188
this.clean = false
189189
this.initialized = true
190-
return callback()
190+
return callback(null, this)
191191
})
192192
})
193193
}

‎src/ipfsd-in-proc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class Node extends EventEmitter {
162162
if (err) { return callback(err) }
163163
self.clean = false
164164
self.initialized = true
165-
return callback()
165+
return callback(null, this)
166166
})
167167
})
168168
}

0 commit comments

Comments
 (0)
Please sign in to comment.