Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Latest commit

 

History

History
104 lines (67 loc) · 2.28 KB

MISCELLANEOUS.md

File metadata and controls

104 lines (67 loc) · 2.28 KB

Miscellaneous API

id

Returns the identity of the Peer

Go WIP
JavaScript - ipfs.id([callback])

callback must follow function (err, identity) {} signature, where err is an error if the operation was not successful. identity is an object with the Peer identity.

If no callback is passed, a promise is returned.

Example:

ipfs.id(function (err, identity) {
  if (err) {
    throw err
  }
  console.log(identity)
})

A great source of examples can be found in the tests for this API.

version

Returns the implementation version

Go WIP
JavaScript - ipfs.version([callback])

callback must follow function (err, version) {} signature, where err is an error if the operation was not successful. version is an object with the version of the implementation, the commit and the Repo.

If no callback is passed, a promise is returned.

Example:

ipfs.version((err, version) => {
  if (err) {
    throw err
  }
  console.log(version)
})

A great source of examples can be found in the tests for this API.

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:

ipfs.dns('ipfs.io', (err, path) => {
  if (err) {
    throw err
  }
  console.log(path)
})

A great source of examples can be found in the tests for this API.

stop

Stops the IPFS node and in case of talking with an IPFS Daemon, it stops the process.

Go WIP
JavaScript - ipfs.stop([callback])

callback must follow function (err) {} signature, where err is an error if the operation was not successful. If no callback is passed, a promise is returned.

Example:

ipfs.stop((err) => {
  if (err) { 
    throw err
  }
})

A great source of examples can be found in the tests for this API.