npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@multiformats/mafmt

v12.1.6

Published

A multiaddr validator

Downloads

105,585

Readme

@multiformats/mafmt

multiformats.io codecov CI

A multiaddr validator

Table of contents

Install

$ npm i @multiformats/mafmt

Browser <script> tag

Loading this module through a script tag will make it's exports available as MultiformatsMafmt in the global namespace.

<script src="https://unpkg.com/@multiformats/mafmt/dist/index.min.js"></script>

Usage

import * as mafmt from '@multiformats/mafmt'

mafmt.DNS.matches('/dns4/ipfs.io') // true

API

mafmt.<FORMAT>.matches(multiaddr)

Where <FORMAT> may be:

| <FORMAT> | Description | Example(s) | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | DNS | a "dns4" or "dns6" format multiaddr | /dnsaddr/ipfs.io | | DNS4 | a "dns4" format multiaddr | /dns4/ipfs.io | | DNS6 | a "dns6" format multiaddr | /dns6/protocol.ai/tcp/80 | | IP | an "ip4" or "ip6" format multiaddr | /ip4/127.0.0.1 /ip6/fc00:: | | TCP | a "tcp" over IP format multiaddr | /ip4/0.0.7.6/tcp/1234 | | UDP | a "udp" over IP format multiaddr | /ip4/0.0.7.6/udp/1234 | | QUIC | a "quic" over UDP format multiaddr | /ip4/1.2.3.4/udp/1234/quic | | UTP | a "utp" over UDP format multiaddr | /ip4/1.2.3.4/udp/3456/utp | | Websockets | a "ws" over TCP or "ws" over DNS format multiaddr | /ip4/1.2.3.4/tcp/3456/ws /dnsaddr/ipfs.io/ws | | WebSocketsSecure | a "wss" over TCP or "wss" over DNS format multiaddr | /ip6/::/tcp/0/wss /dnsaddr/ipfs.io/wss | | HTTP | a "http" over TCP or DNS or "http" over DNS format multiaddr | /ip4/127.0.0.1/tcp/90/http /dnsaddr/ipfs.io/http | | HTTPS | a "https" over TCP or DNS or "https" over DNS format multiaddr | /ip4/127.0.0.1/tcp/90/https /dnsaddr/ipfs.io/https | | WebRTCStar | a "p2p" over "p2p-webrtc-star" over Websockets or "p2p" over "p2p-webrtc-star" over WebSocketsSecure format multiaddr | /dnsaddr/ipfs.io/wss/p2p-webrtc-star/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 | | WebSocketStar | a "p2p" over "p2p-websocket-star" over Websockets or "p2p" over "p2p-websocket-star" over WebSocketsSecure or "p2p-websocket-star" over Websockets or "p2p-websocket-star" over WebSocketsSecure format multiaddr | /ip4/1.2.3.4/tcp/3456/ws/p2p-websocket-star /dnsaddr/localhost/ws/p2p-websocket-star/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 | | WebRTCDirect | a "p2p-webrtc-direct" over HTTP or "p2p-webrtc-direct" over HTTPS format multiaddr | /ip4/1.2.3.4/tcp/3456/http/p2p-webrtc-direct | | Reliable | a WebSockets or WebSocketsSecure or HTTP or HTTPS or WebRTCStar or WebRTCDirect or TCP or UTP or QUIC format multiaddr | /dnsaddr/ipfs.io/wss | | Circuit | | /p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4/p2p-circuit/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj | | P2P | "p2p", aka "ipfs", over Reliable or WebRTCStar or "p2p" format multiaddr | /p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSoooo4 /ip4/127.0.0.1/tcp/20008/ws/p2p/QmUjNmr8TgJCn1Ao7DvMy4cjoZU15b9bwSCBLE3vwXiwgj |

Where multiaddr may be:

Returns true/false

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.