Socket
Socket
Sign inDemoInstall

bittorrent-lsd

Package Overview
Dependencies
5
Maintainers
9
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bittorrent-lsd

Local Service Discovery (BEP14) implementation


Version published
Weekly downloads
2.9K
decreased by-9.36%
Maintainers
9
Install size
87.8 kB
Created
Weekly downloads
 

Readme

Source

bittorrent-lsd ci npm downloads javascript style guide

Local Service Discovery (BEP14) implementation.

Local Service Discovery (LSD) provides a SSDP-like (http over udp-multicast) mechanism to announce the presence in specific swarms to local neighbors.

This module is used by WebTorrent.

install

npm install bittorrent-lsd

example

const opts = {
  peerId: new Buffer('01234567890123456789'), // hex string or Buffer
  infoHash: new Buffer('01234567890123456789'), // hex string or Buffer
  port: common.randomPort() // torrent client port
}

const lsd = new LSD(opts)

// start getting peers from local network
lsd.start()

lsd.on('peer', (peerAddress, infoHash) => {
  console.log('found a peer: ' + peerAddress)
})

lsd.destroy()

api

lsd = new LSD([opts])

Create a new lsd instance.

lsd.start()

Start listening and sending (every 5 minutes) for local network announces.

lsd.destroy([callback])

Destroy the LSD. Closes the socket and cleans up resources.

events

lsd.on('peer', (peerAddress, infoHash) => { ... })

Emitted when a potential peer is found. peerAddress is of the form host:port. infoHash is the torrent info hash.

lsd.on('warning', (err) => { ... })

Emitted when the LSD gets an unexpected message.

lsd.on('error', (err) => { ... })

Emitted when the LSD has a fatal error.

license

MIT. Copyright (c) Julen Garcia Leunda and WebTorrent, LLC.

Keywords

FAQs

Last updated on 05 Dec 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc