0.26.1
Installable via npm install --save ipfs-bitswap
, it can also be used directly in the browser.
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save ipfs-bitswap
You can then require()
ipfs-bitswap as normal:
const ipfsBitswap = require('ipfs-bitswap')
Ipfs-bitswap should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipfs-bitswap, including index.js
and index.min.js
, are included in the /dist
folder. Ipfs-bitswap can also be found on unpkg.com under
JavaScript implementation of the Bitswap 'data exchange' protocol used by IPFS.
void
:
void
:
Fetch a a list of blocks by cid. If the blocks are in the local blockstore they are returned, otherwise the blocks are added to the wantlist and returned once another node sends them to us.
(Iterable<CID>)
Promise<AsyncIterator<Block>>
:
Removes the given CIDs from the wantlist independent of any ref counts
(Iterable<CID>)
void
:
Removes the given keys from the want list
(Iterable<CID>)
void
:
Get the current list of wants.
Iterator<WantlistEntry>
:
Get the current list of partners.
Iterator<PeerId>
:
Start the bitswap node.
void
:
Stop the bitswap node.
void
:
Find providers given a cid
.
(CID)
(number)
Promise<Result<Array>>
:
Find the providers of a given cid
and connect to them.
(CID)
void
:
Connects to another peer
((PeerInfo | PeerId | Multiaddr))
Promise<Connection>
:
Is equal for Maps of BitswapMessageEntry or Blocks
boolean
: