mirror of
https://github.com/fluencelabs/js-peer-id
synced 2025-04-25 17:42:37 +00:00
249 lines
6.4 KiB
HTML
249 lines
6.4 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<title>peer-id 0.13.5 | Documentation</title>
|
|
<meta name='description' content='IPFS Peer Id implementation in Node.js'>
|
|
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
<link href='assets/bass.css' rel='stylesheet'>
|
|
<link href='assets/style.css' rel='stylesheet'>
|
|
<link href='assets/github.css' rel='stylesheet'>
|
|
<link href='assets/split.css' rel='stylesheet'>
|
|
</head>
|
|
<body class='documentation m0'>
|
|
<div class='flex'>
|
|
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
|
|
<div class='py1 px2'>
|
|
<h3 class='mb0 no-anchor'>peer-id</h3>
|
|
<div class='mb1'><code>0.13.5</code></div>
|
|
<input
|
|
placeholder='Filter'
|
|
id='filter-input'
|
|
class='col12 block input'
|
|
type='text' />
|
|
<div id='toc'>
|
|
<ul class='list-reset h5 py1-ul'>
|
|
|
|
|
|
<li><a
|
|
href='#intro'
|
|
class="h5 bold black caps">
|
|
Intro
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
<li><a
|
|
href='#equals'
|
|
class="">
|
|
equals
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
|
|
<li><a
|
|
href='#isequal'
|
|
class="">
|
|
isEqual
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
<div class='mt1 h6 quiet'>
|
|
<a href='https://documentation.js.org/reading-documentation.html'>Need help reading this?</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id='split-right' class='relative overflow-auto height-viewport-100'>
|
|
|
|
|
|
<div class='keyline-top-not py2'><section class='py2 clearfix'>
|
|
|
|
<h2 id='intro' class='mt0'>
|
|
Intro
|
|
</h2>
|
|
|
|
|
|
<p>Installable via <code>npm install --save peer-id</code>, it can also be used directly in the browser.</p>
|
|
<h2>Download</h2>
|
|
<p>The source is available for download from <a href="https://github.com/libp2p/js-peer-id.git">GitHub</a>. Alternatively, you can install using npm:</p>
|
|
<pre class='hljs'>$ npm install --save peer-id</pre>
|
|
<p>You can then <code>require()</code> peer-id as normal:</p>
|
|
<pre class='hljs'><span class="hljs-keyword">const</span> peerId = <span class="hljs-built_in">require</span>(<span class="hljs-string">'peer-id'</span>)</pre>
|
|
<h2>In the Browser</h2>
|
|
<p>Peer-id should work in any ES2015 environment out of the box.</p>
|
|
<p>Usage:</p>
|
|
<pre class='hljs'><span class="hljs-tag"><<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text/javascript"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"index.js"</span>></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></pre>
|
|
<p>The portable versions of peer-id, including <code>index.js</code> and <code>index.min.js</code>, are included in the <code>/dist</code> folder. Peer-id can also be found on <a href="https://unpkg.com">unpkg.com</a> under</p>
|
|
<ul>
|
|
<li><a href="https://unpkg.com/peer-id/dist/index.min.js">https://unpkg.com/peer-id/dist/index.min.js</a></li>
|
|
<li><a href="https://unpkg.com/peer-id/dist/index.js">https://unpkg.com/peer-id/dist/index.js</a></li>
|
|
</ul>
|
|
|
|
|
|
</section></div>
|
|
|
|
|
|
|
|
<section class='p2 mb2 clearfix bg-white minishadow'>
|
|
|
|
|
|
<div class='clearfix'>
|
|
|
|
<h3 class='fl m0' id='equals'>
|
|
equals
|
|
</h3>
|
|
|
|
|
|
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-peer-id/blob/b5335cd4ee08574040fc5bb5bc61c6d30e0c53b0/src/index.js#L141-L149'>
|
|
<span>src/index.js</span>
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
<p>Checks the equality of <code>this</code> peer against a given PeerId.</p>
|
|
|
|
<div class='pre p1 fill-light mt0'>equals(id: (<a href="https://nodejs.org/api/buffer.html">Buffer</a> | PeerId)): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class='py1 quiet mt1 prose-big'>Parameters</div>
|
|
<div class='prose'>
|
|
|
|
<div class='space-bottom0'>
|
|
<div>
|
|
<span class='code bold'>id</span> <code class='quiet'>((<a href="https://nodejs.org/api/buffer.html">Buffer</a> | PeerId))</code>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class='py1 quiet mt1 prose-big'>Returns</div>
|
|
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section class='p2 mb2 clearfix bg-white minishadow'>
|
|
|
|
|
|
<div class='clearfix'>
|
|
|
|
<h3 class='fl m0' id='isequal'>
|
|
isEqual
|
|
</h3>
|
|
|
|
|
|
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-peer-id/blob/b5335cd4ee08574040fc5bb5bc61c6d30e0c53b0/src/index.js#L157-L159'>
|
|
<span>src/index.js</span>
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
<p>Checks the equality of <code>this</code> peer against a given PeerId.</p>
|
|
|
|
<div class='pre p1 fill-light mt0'>isEqual(id: (<a href="https://nodejs.org/api/buffer.html">Buffer</a> | PeerId)): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></div>
|
|
|
|
|
|
|
|
<div>Deprecated: Use
|
|
<code>.equals</code>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class='py1 quiet mt1 prose-big'>Parameters</div>
|
|
<div class='prose'>
|
|
|
|
<div class='space-bottom0'>
|
|
<div>
|
|
<span class='code bold'>id</span> <code class='quiet'>((<a href="https://nodejs.org/api/buffer.html">Buffer</a> | PeerId))</code>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class='py1 quiet mt1 prose-big'>Returns</div>
|
|
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code>:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<script src='assets/anchor.js'></script>
|
|
<script src='assets/split.js'></script>
|
|
<script src='assets/site.js'></script>
|
|
</body>
|
|
</html>
|