Skip to content

Stiveknx/webtorrent-hybrid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebTorrent (with WebRTC support in Node.js)

Build Status NPM Version NPM Downloads

Streaming torrent client for node environments

In node.js, the webtorrent package only connects to normal TCP/UDP peers, not WebRTC peers. If you want to connect to all types of peers, including WebRTC peers, from node.js, you need to use this package (webtorrent-hybrid).

Previous versions (0.x) of this package used wrtc, a WebRTC implementation via native extensions, the current one is based on electron-webrtc (which in turn uses electron-prebuilt) for better compatibility. It creates a hidden Electron process (which is based on Chromium, so WebRTC support is great!) and communicates with that process to enable WebRTC in Node.js. This adds a lot of overhead, so we are looking forward to using a pure JavaScript implementation, like perhaps Node-RTCPeerConnection when it's ready.

To run this package on a headless server execute the provided script or follow these instructions.

js-standard-style

Install

The current version of webtorrent-hybrid requires an screen as the headless electron expects one. In case that you are running in a screenless environment you must use a virtual screen such as xvfb. You must first install it and run it. For Debian based OSs:

sudo apt-get install xvfb
export DISPLAY='0:99'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

For Centos/rhel:

sudo yum install xorg-x11-server-Xvfb
export DISPLAY='0:99'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

Also, if you're running webtorrent-hybrid in a node.js project, you can start Xvfb within your app:

npm install xvfb

var Xvfb = require('xvfb')
var xvfb = new Xvfb()
xvfb.startSync()

Webtorrent = require('webtorrent-hybrid')

To install WebTorrent:

npm install webtorrent-hybrid

To install a webtorrent-hybrid command line program, run:

npm install webtorrent-hybrid -g

Usage

webtorrent-hybrid has the same command line interface (CLI) and module API as webtorrent. Just require('webtorrent-hybrid') instead of require('webtorrent').

See the WebTorrent docs.

License

MIT. Copyright (c) Feross Aboukhadijeh.

About

WebTorrent (with WebRTC support in Node.js)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 50.9%
  • JavaScript 49.1%