Package Exports
- ipfsd-ctl
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipfsd-ctl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ipfsd-ctl
Control an ipfs node daemon using Node.js
Table of Contents
Install
Install:
npm install --save ipfsd-ctlUsage
IPFS daemons are already easy to start and stop, but this module is here to do it from JavaScript itself.
// Start a disposable node, and get access to the api
// print the node id, and kill the temporary daemon
// IPFS_PATH will point to /tmp/ipfs_***** and will be
// cleaned up when the process exits.
var ipfsd = require('ipfsd-ctl')
ipfsd.disposableApi(function (err, ipfs) {
ipfs.id(function (err, id) {
console.log(id)
process.exit()
})
})If you need want to use an existing ipfs installation you can set $IPFS_EXEC=/path/to/ipfs to ensure it uses that.
For more details see https://ipfs.github.io/js-ipfsd-ctl/.
Packaging
ipfsd-ctl can be packaged in Electron applications, but the ipfs binary
has to be excluded from asar (Electron Archives),
read more about unpack files from asar.
ipfsd-ctl will try to detect if used from within an app.asar archive
and tries to resolve ipfs from app.asar.unpacked. The ipfs binary is part of
the go-ipfs-dep module.
electron-packager ./ --asar.unpackDir=node_modules/go-ipfs-depContribute
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
