Intro
Installable via npm install --save ipfsd-ctl, it can also be used directly in the browser.
Download
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save ipfsd-ctl
You can then require() ipfsd-ctl as normal:
const ipfsdCtl = require('ipfsd-ctl')
In the Browser
Ipfsd-ctl should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipfsd-ctl, including index.js and index.min.js, are included in the /dist folder. Ipfsd-ctl can also be found on unkpkg.com under
Node
Controll a go-ipfs node.
Parameters
path: any:opts: any:disposable: any:
instance
Node.prototype.gatewayAddr
gatewayAddrGet the address of connected IPFS HTTP Gateway.
Returns
Multiaddr
Node.prototype.init
init(initOpts: Object, callback: function (Error, Node)): undefinedInitialize a repo.
Parameters
Returns
Node.prototype.shutdown
shutdown(callback: function (Error)): undefinedDelete the repo that was being used.
If the node was marked as disposable this will be called
automatically when the process is exited.
Parameters
callback: function (Error):
Returns
Node.prototype.startDaemon
startDaemon(flags: Array<string>, callback: function (Error, IpfsApi)): undefinedStart the daemon.
Parameters
callback: function (Error, IpfsApi):
Returns
Node.prototype.stopDaemon
stopDaemon(callback: function (Error)): undefinedStop the daemon.
Parameters
callback: function (Error):
Returns
Node.prototype.killProcess
killProcess(callback: function ()): undefinedKill the ipfs daemon process.
First SIGTERM is sent, after 7.5 seconds SIGKILL is sent
if the process hasn't exited yet.
Parameters
callback: function ():Called when the process was killed.
Returns
Node.prototype.getConfig
getConfig(key: string?, callback: function (Error, (Object | string))): undefinedCall ipfs config
If no key is passed, the whole config is returned as an object.
Parameters
key: string?:A specific config to retrieve.
Returns
Node.prototype.setConfig
setConfig(key: string, value: string, callback: function (Error)): undefinedSet a config value.
Returns
IpfsDaemonController
Control go-ipfs nodes directly from JavaScript.
static
IpfsDaemonController.version
version(callback: function (Error, string)): undefinedGet the version of the currently used go-ipfs binary.
Returns
IpfsDaemonController.local
local(path: string?, opts: Object, callback: function (Error, Node)): undefinedCreate a new local node.