Socket
Book a DemoInstallSign in
Socket

peer-wire-swarm

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peer-wire-swarm

a peer swarm implementation

latest
Source
npmnpm
Version
0.12.2
Version published
Maintainers
1
Created
Source

peer-wire-swarm

Swarm implementation for Bittorrent

npm install peer-wire-swarm

Usage

var wireSwarm = require('peer-wire-swarm');
var swarm = wireSwarm(myInfoHash, myPeerId);

swarm.on('wire', function(wire) {
	// a relevant peer-wire-protocol as appeared
	// see the peer-wire-protocol module for more info

	wire.on('unchoke', function() {
		// we are now unchoked
	});

	swarm.wires // <- list of all connected wires
});

swarm.add('127.0.0.1:42442'); // add a peer
swarm.remove('127.0.0.1:42244'); // remove a peer

swarm.pause();  // pause the swarm (stops adding connections)
swarm.resume(); // resume the swarms

swarm.listen(6881); // listen for incoming connections (optional)

License

MIT

FAQs

Package last updated on 23 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts