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

Commit

Permalink
feat: ipfs.stop
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider authored and daviddias committed Feb 7, 2018
1 parent 895760e commit 5091115
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"P
- [`ipfs.version([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#version)
- [`ipfs.ping()`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#ping)
- [`ipfs.dns(domain, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#dns)
- [`ipfs.stop([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#stop). Alias to `ipfs.shutdown`.
- [config](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/CONFIG.md)
- [`ipfs.config.get([key, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/CONFIG.md#configget)
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
"multihashes": "~0.4.13",
"ndjson": "^1.5.0",
"once": "^1.4.0",
"peer-id": "~0.10.4",
"peer-info": "~0.11.4",
"peer-id": "~0.10.5",
"peer-info": "~0.11.6",
"promisify-es6": "^1.0.3",
"pull-defer": "^0.2.2",
"pull-pushable": "^2.1.2",
"pump": "^2.0.0",
"pump": "^3.0.0",
"qs": "^6.5.1",
"readable-stream": "^2.3.3",
"stream-http": "^2.7.2",
"stream-http": "^2.8.0",
"stream-to-pull-stream": "^1.7.2",
"streamifier": "^0.1.1",
"tar-stream": "^1.5.5"
Expand All @@ -63,15 +63,15 @@
"url": "https://github.com/ipfs/js-ipfs-api"
},
"devDependencies": {
"aegir": "^12.3.0",
"aegir": "^12.4.0",
"chai": "^4.1.2",
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-react": "^7.6.1",
"go-ipfs-dep": "^0.4.13",
"gulp": "^3.9.1",
"hapi": "^16.6.2",
"interface-ipfs-core": "~0.47.0",
"ipfsd-ctl": "~0.27.0",
"interface-ipfs-core": "~0.48.0",
"hapi": "^17.2.0",
"ipfsd-ctl": "~0.27.3",
"pre-commit": "^1.2.2",
"socket.io": "^2.0.4",
"socket.io-client": "^2.0.4",
Expand Down
12 changes: 12 additions & 0 deletions src/stop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const promisify = require('promisify-es6')
const moduleConfig = require('./utils/module-config')

module.exports = (arg) => {
const send = moduleConfig(arg)

return promisify((callback) => {
send({ path: 'shutdown' }, callback)
})
}
4 changes: 4 additions & 0 deletions src/utils/load-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function requireCommands () {
ping: require('../ping'),
refs: require('../refs'),
repo: require('../repo'),
stop: require('../stop'),
stats: require('../stats'),
swarm: require('../swarm'),
pubsub: require('../pubsub'),
Expand All @@ -41,6 +42,9 @@ function requireCommands () {
dns: require('../dns')
}

// shutdown is an alias for stop
cmds.shutdown = cmds.stop

// TODO: crowding the 'files' namespace temporarily for interface-ipfs-core
// compatibility, until 'files vs mfs' naming decision is resolved.
cmds.files = function (send) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const IPFSApi = require('../../src')

Expand All @@ -27,7 +26,9 @@ const common = {
})
},
teardown: function (callback) {
parallel(nodes.map((node) => (cb) => node.stop(cb)), callback)
// No need to stop, because the test suite does a 'stop' test.
// parallel(nodes.map((node) => (cb) => node.stop(cb)), callback)
callback()
}
}

Expand Down

0 comments on commit 5091115

Please sign in to comment.