mirror of
https://github.com/fluencelabs/js-multiaddr-to-uri
synced 2024-12-05 03:40:35 +00:00
1.1 KiB
1.1 KiB
multiaddr-to-stupid-string
Convert a Multiaddr to a stupid string /dnsaddr/ipfs.io/http -> http://ipfs.io
Install
npm install multiaddr-to-stupid-string
Usage
const toStupid = require('multiaddr-to-stupid-string')
console.log(toStupid('/dnsaddr/protocol.ai/https'))
// -> https://protocol.ai
Note:
- Might be lossy - e.g. a DNSv6 multiaddr
- Can throw if the passed multiaddr:
- is not a valid multiaddr
- is not supported as a stupid string e.g. circuit
Contribute
Feel free to dive in! Open an issue or submit PRs.
License
MIT © Alan Shaw