mirror of
https://github.com/fluencelabs/js-libp2p-utils
synced 2025-04-25 12:02:17 +00:00
135 lines
7.7 KiB
HTML
135 lines
7.7 KiB
HTML
<!doctype html>
|
|
<html class="default no-js">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title>libp2p-utils - v0.3.0</title>
|
|
<meta name="description" content="Documentation for libp2p-utils - v0.3.0">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="assets/css/main.css">
|
|
<script async src="assets/js/search.js" id="search-script"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="tsd-page-toolbar">
|
|
<div class="container">
|
|
<div class="table-wrap">
|
|
<div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
|
|
<div class="field">
|
|
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
<input id="tsd-search-field" type="text" />
|
|
</div>
|
|
<ul class="results">
|
|
<li class="state loading">Preparing search index...</li>
|
|
<li class="state failure">The search index is not available</li>
|
|
</ul>
|
|
<a href="index.html" class="title">libp2p-utils - v0.3.0</a>
|
|
</div>
|
|
<div class="table-cell" id="tsd-widgets">
|
|
<div id="tsd-filter">
|
|
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
<div class="tsd-filter-group">
|
|
<div class="tsd-select" id="tsd-filter-visibility">
|
|
<span class="tsd-select-label">All</span>
|
|
<ul class="tsd-select-list">
|
|
<li data-value="public">Public</li>
|
|
<li data-value="protected">Public/Protected</li>
|
|
<li data-value="private" class="selected">All</li>
|
|
</ul>
|
|
</div>
|
|
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
<input type="checkbox" id="tsd-filter-externals" checked />
|
|
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
|
|
</div>
|
|
</div>
|
|
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="tsd-page-title">
|
|
<div class="container">
|
|
<h1>libp2p-utils - v0.3.0</h1>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="container container-main">
|
|
<div class="row">
|
|
<div class="col-8 col-content">
|
|
<div class="tsd-panel tsd-typography">
|
|
<a href="#js-libp2p-utils" id="js-libp2p-utils" style="color: inherit; text-decoration: none;">
|
|
<h1>js-libp2p-utils</h1>
|
|
</a>
|
|
<p><a href="http://protocol.ai"><img src="https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square" alt=""></a>
|
|
<a href="http://libp2p.io/"><img src="https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square" alt=""></a>
|
|
<a href="http://webchat.freenode.net/?channels=%23libp2p"><img src="https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square" alt=""></a>
|
|
<a href="https://discuss.libp2p.io"><img src="https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg" alt="Discourse posts"></a>
|
|
<a href="https://codecov.io/gh/libp2p/js-libp2p-utils"><img src="https://img.shields.io/codecov/c/github/libp2p/js-libp2p-utils.svg?style=flat-square" alt=""></a>
|
|
<a href="https://travis-ci.com/libp2p/js-libp2p-utils"><img src="https://img.shields.io/travis/libp2p/js-libp2p-utils.svg?style=flat-square" alt=""></a>
|
|
<a href="https://david-dm.org/libp2p/js-libp2p-utils"><img src="https://david-dm.org/libp2p/js-libp2p-utils.svg?style=flat-square" alt="Dependency Status"></a>
|
|
<a href="https://github.com/feross/standard"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="js-standard-style"></a></p>
|
|
<blockquote>
|
|
<p>This package serves as a central repository for shared logic and dependencies for all libp2p packages, using <code>libp2p-utils</code> helps to easily re-use small scoped blocks of logic across all libp2p modules and also as a dependency proxy (think <code>aegir</code> for domain logic dependencies).</p>
|
|
</blockquote>
|
|
<p>The libp2p ecosystem has lots of repos with it comes several problems like: </p>
|
|
<ul>
|
|
<li>Domain logic dedupe - all modules shared a lot of logic like validation, streams handling, etc.</li>
|
|
<li>Dependencies management - it's really easy with so many repos for dependencies to go out of control, they become outdated, different repos use different modules to do the same thing (like merging defaults options), browser bundles ends up with multiple versions of the same package, bumping versions is cumbersome to do because we need to go through several repos, etc.</li>
|
|
</ul>
|
|
<p>These problems are the motivation for this package, having shared logic in this package avoids creating cyclic dependencies, centralizes common use modules/functions (exactly like aegir does for the tooling), semantic versioning for 3rd party dependencies is handled in one single place (a good example is going from streams 2 to 3) and maintainers should only care about having <code>libp2p-utils</code> updated.</p>
|
|
<a href="#lead-maintainer" id="lead-maintainer" style="color: inherit; text-decoration: none;">
|
|
<h2>Lead Maintainer</h2>
|
|
</a>
|
|
<p><a href="https://github.com/vasco-santos">Vasco Santos</a></p>
|
|
<a href="#install" id="install" style="color: inherit; text-decoration: none;">
|
|
<h2>Install</h2>
|
|
</a>
|
|
<pre><code class="language-bash"><span style="color: #000000">$ npm install --save libp2p-utils</span>
|
|
</code></pre>
|
|
<a href="#usage" id="usage" style="color: inherit; text-decoration: none;">
|
|
<h2>Usage</h2>
|
|
</a>
|
|
<p>Each function should be imported directly.</p>
|
|
<pre><code class="language-js"><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">ipAndPortToMultiaddr</span><span style="color: #000000"> = </span><span style="color: #795E26">require</span><span style="color: #000000">(</span><span style="color: #A31515">'libp2p-utils/src/ip-port-to-multiaddr'</span><span style="color: #000000">)</span>
|
|
|
|
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">ma</span><span style="color: #000000"> = </span><span style="color: #795E26">ipAndPortToMultiaddr</span><span style="color: #000000">(</span><span style="color: #A31515">'127.0.0.1'</span><span style="color: #000000">, </span><span style="color: #098658">9000</span><span style="color: #000000">)</span>
|
|
</code></pre>
|
|
<p>You can check the <a href="./API.md">API docs</a>.</p>
|
|
<a href="#contribute" id="contribute" style="color: inherit; text-decoration: none;">
|
|
<h2>Contribute</h2>
|
|
</a>
|
|
<p>Contributions welcome. Please check out <a href="https://github.com/libp2p/js-libp2p-utils/issues">the issues</a>.</p>
|
|
<p>Check out our <a href="https://github.com/ipfs/community/blob/master/contributing.md">contributing document</a> for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS <a href="https://github.com/ipfs/community/blob/master/code-of-conduct.md">Code of Conduct</a>.</p>
|
|
<a href="#license" id="license" style="color: inherit; text-decoration: none;">
|
|
<h2>License</h2>
|
|
</a>
|
|
<p><a href="LICENSE">MIT</a> © Protocol Labs Inc.</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
<nav class="tsd-navigation primary">
|
|
<ul>
|
|
<li class=" ">
|
|
<a href="modules.html">Exports</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<nav class="tsd-navigation secondary menu-sticky">
|
|
<ul class="before-current">
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer>
|
|
<div class="container">
|
|
<h2>Legend</h2>
|
|
<div class="tsd-legend-group">
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
<div class="overlay"></div>
|
|
<script src="assets/js/main.js"></script>
|
|
</body>
|
|
</html> |