victorb / js-ipfs-bitswap

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:JavaScript 100.0%