diff --git a/README.md b/README.md index cad05cfb8..ed914f899 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,7 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"P - [`ipfs.id([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/SPEC/MISCELLANEOUS.md#id) - [`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) - [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) diff --git a/package.json b/package.json index 68d22d765..11060ee9d 100644 --- a/package.json +++ b/package.json @@ -35,15 +35,15 @@ "is-ipfs": "^0.3.2", "is-stream": "^1.1.0", "lru-cache": "^4.1.1", - "multiaddr": "^3.0.1", - "multihashes": "~0.4.12", + "multiaddr": "^3.0.2", + "multihashes": "~0.4.13", "ndjson": "^1.5.0", "once": "^1.4.0", "peer-id": "~0.10.4", "peer-info": "~0.11.4", "promisify-es6": "^1.0.3", "pull-defer": "^0.2.2", - "pull-pushable": "^2.1.1", + "pull-pushable": "^2.1.2", "pump": "^1.0.3", "qs": "^6.5.1", "readable-stream": "^2.3.3", @@ -66,7 +66,7 @@ "dirty-chai": "^2.0.1", "eslint-plugin-react": "^7.5.1", "gulp": "^3.9.1", - "interface-ipfs-core": "~0.38.0", + "interface-ipfs-core": "~0.40.0", "hapi": "^16.6.2", "ipfsd-ctl": "~0.26.0", "pre-commit": "^1.2.2", diff --git a/src/dns.js b/src/dns.js new file mode 100644 index 000000000..3f734bfc2 --- /dev/null +++ b/src/dns.js @@ -0,0 +1,25 @@ +'use strict' + +const promisify = require('promisify-es6') +const moduleConfig = require('./utils/module-config') + +const transform = function (res, callback) { + callback(null, res.Path) +} + +module.exports = (arg) => { + const send = moduleConfig(arg) + + return promisify((args, opts, callback) => { + if (typeof (opts) === 'function') { + callback = opts + opts = {} + } + + send.andTransform({ + path: 'dns', + args: args, + qs: opts + }, transform, callback) + }) +} diff --git a/src/utils/load-commands.js b/src/utils/load-commands.js index f80b1427c..5a2c84ff4 100644 --- a/src/utils/load-commands.js +++ b/src/utils/load-commands.js @@ -37,7 +37,8 @@ function requireCommands () { swarm: require('../swarm'), pubsub: require('../pubsub'), update: require('../update'), - version: require('../version') + version: require('../version'), + dns: require('../dns') } // TODO: crowding the 'files' namespace temporarily for interface-ipfs-core