diff --git a/SPEC/MISCELLANEOUS.md b/SPEC/MISCELLANEOUS.md index a3db153ba..ee6e2dd91 100644 --- a/SPEC/MISCELLANEOUS.md +++ b/SPEC/MISCELLANEOUS.md @@ -52,3 +52,26 @@ ipfs.version((err, version) => { A great source of [examples][] can be found in the tests for this API. [examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/generic.js + +#### `dns` + +> Resolve DNS links + +##### `Go` **WIP** + +##### `JavaScript` - ipfs.dns(domain, [callback]) + +`callback` must follow `function (err, path) {}` signature, where `err` is an error if the operation was not successful. `path` is the IPFS path for that domain. + +If no `callback` is passed, a promise is returned. + +**Example:** + +```JavaScript +ipfs.dns('ipfs.io', (err, path) => { + if (err) { + throw err + } + console.log(path) +}) +``` diff --git a/src/miscellaneous.js b/src/miscellaneous.js index 7b9d8c9fb..4e3eaec42 100644 --- a/src/miscellaneous.js +++ b/src/miscellaneous.js @@ -50,6 +50,13 @@ module.exports = (common) => { }) }) + it('.dns', () => { + return ipfs.dns('ipfs.io', (err, path) => { + expect(err).to.not.exist() + expect(path).to.exist() + }) + }) + it('.id Promises support', () => { return ipfs.id() .then((res) => { @@ -66,5 +73,12 @@ module.exports = (common) => { expect(result).to.have.a.property('repo') }) }) + + it('.dns Promises support', () => { + return ipfs.dns('ipfs.io') + .then((res) => { + expect(res).to.exist() + }) + }) }) }