https://github.com/chancehudson/dnslink
Resolve and update domain dnslink records
https://github.com/chancehudson/dnslink
Last synced: about 1 year ago
JSON representation
Resolve and update domain dnslink records
- Host: GitHub
- URL: https://github.com/chancehudson/dnslink
- Owner: chancehudson
- Created: 2018-11-07T15:34:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-31T05:05:12.000Z (over 7 years ago)
- Last Synced: 2025-04-28T14:05:33.204Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 113 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# dnslink [](https://travis-ci.org/common-theory/dnslink) [](https://www.npmjs.com/package/dnslink) [](https://github.com/common-theory/dnslink)
A javascript [dnslink](https://docs.ipfs.io/guides/concepts/dnslink/) resolution implementation. See [ipfs/go-dnslink](https://github.com/ipfs/go-dnslink) for more information.
## Usage
### `update`
#### Command Line
Create a dnslink binding via digitalocean.
An environment variable called `DIGITAL_OCEAN_TOKEN` should be set.
```sh
$ jsdnslink update commontheory.io /ipfs/QmStyTZJJugmdFub1GBBGhtXpwxghT4EGvBCz8jNSLdBcy
Unable to find dnslink record, creating a new one
DNS record updated
```
#### JS/TS
```ts
import { update } from 'dnslink';
// async/await
await update('commontheory.io', '/ipfs/QmStyTZJJugmdFub1GBBGhtXpwxghT4EGvBCz8jNSLdBcy');
// promises
update('commontheory.io', '/ipfs/QmStyTZJJugmdFub1GBBGhtXpwxghT4EGvBCz8jNSLdBcy')
.then(() => /* Your logic */);
```
### `resolve`
Get the CID associated with a domain. This evaluates via the DNS, not IPFS.
#### Command Line
```sh
$ jsdnslink resolve commontheory.io
/ipfs/QmStyTZJJugmdFub1GBBGhtXpwxghT4EGvBCz8jNSLdBcy
```
#### JS/TS
```ts
import { resolve } from 'dnslink';
// async/await
const cid = await resolve('commontheory.io');
// promises
resolve('commontheory.io')
.then(cid => /* Your logic */);
```
## Note
This package is not maintained by, or affiliated with IPFS or Protocol Labs.