/js-ipfs-bitswap

JavaScript implementation of Bitswap 'data exchange' protocol used by IPFS

Primary LanguageJavaScriptMIT LicenseMIT

ipfs-bitswap

JavaScript implementation of the Bitswap 'data exchange' protocol used by IPFS

Table of Contents

Install

npm

> npm install ipfs-bitswap

Use in Node.js or in the browser with browserify, webpack or any other bundler

const Bitswap = require('ipfs-bitswap')

Use in a browser using a script tag

Loading this module through a script tag will make the IpfsBitswap object available in the global namespace.

<script src="https://unpkg.com/ipfs-bitswap/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipfs-bitswap/dist/index.js"></script>

API

See https://ipfs.github.io/js-ipfs-bitswap

Development

Structure

» tree src
src
├── constants.js
├── decision-engine
│   ├── index.js
│   └── ledger.js
├── index.js
├── network.js             # Handles peerSet and open new conns
├── notifications.js       # Handles tracking of incomning blocks and wants/unwants.
├─── want-manager          # Keeps track of all blocks the peer (self) wants
│   ├── index.js
│   └── msg-queue.js       # Messages to send queue, one per peer
└─── types
    ├── message            # (Type) message that is put in the wire
    │   ├── entry.js
    │   ├── index.js
    │   └── message.proto.js
    └── wantlist           # (Type) track wanted blocks
        ├── entry.js
        └── index.js

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT