2018-03-21 10:09:39 +00:00
|
|
|
# multiaddr-to-uri
|
2018-03-20 14:39:26 +00:00
|
|
|
|
2018-03-21 10:09:39 +00:00
|
|
|
[![Build Status](https://travis-ci.org/tableflip/multiaddr-to-uri.svg?branch=master)](https://travis-ci.org/tableflip/multiaddr-to-uri) [![dependencies Status](https://david-dm.org/tableflip/multiaddr-to-uri/status.svg)](https://david-dm.org/tableflip/multiaddr-to-uri) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
2018-03-20 14:39:26 +00:00
|
|
|
|
|
|
|
|
2018-03-21 10:09:39 +00:00
|
|
|
> Convert a Multiaddr to a URI /dnsaddr/ipfs.io/http -> http://ipfs.io
|
2018-03-20 14:39:26 +00:00
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```sh
|
2018-03-21 10:09:39 +00:00
|
|
|
npm install multiaddr-to-uri
|
2018-03-20 14:39:26 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```js
|
2018-03-21 10:09:39 +00:00
|
|
|
const toUri = require('multiaddr-to-uri')
|
2018-03-20 14:39:26 +00:00
|
|
|
|
2018-03-21 10:09:39 +00:00
|
|
|
console.log(toUri('/dnsaddr/protocol.ai/https'))
|
2018-03-20 14:39:26 +00:00
|
|
|
// -> https://protocol.ai
|
|
|
|
```
|
|
|
|
|
|
|
|
Note:
|
|
|
|
|
|
|
|
* Might be lossy - e.g. a DNSv6 multiaddr
|
|
|
|
* Can throw if the passed multiaddr:
|
|
|
|
* is not a valid multiaddr
|
2018-03-21 10:09:39 +00:00
|
|
|
* is not supported as a URI e.g. circuit
|
2018-03-20 14:39:26 +00:00
|
|
|
|
|
|
|
## Contribute
|
|
|
|
|
2018-03-21 10:09:39 +00:00
|
|
|
Feel free to dive in! [Open an issue](https://github.com/tableflip/multiaddr-to-uri/issues/new) or submit PRs.
|
2018-03-20 14:39:26 +00:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
[MIT](LICENSE) © Alan Shaw
|