WebTorrent
The streaming torrent client for Node.js and the web. YEP, THAT’S RIGHT. THE BROWSER.
What is WebTorrent?
WebTorrent is a streaming torrent client for Node.js and the browser. It’s written completely in JavaScript – the language of the web – so the same code works in both runtimes. In Node.js, this module is a simple torrent client, using TCP and UDP to talk to other torrent clients. In the browser, WebTorrent uses WebRTC (data channels) for peer-to-peer transport. It can be used without browser plugins, extensions, or installations. It’s Just JavaScript™.WebTorrent does not support UDP/TCP peers in the browser. For seeding files to web peers, use a client that supports WebRTC such as WebTorrent Desktop, webtorrent-hybrid, or Instant.io.
Key Features
Streaming Downloads
Fetch pieces from the network on-demand so seeking is supported even before the torrent is finished
Cross-Platform
Same API works in Node.js and the browser with no code changes required
WebRTC P2P
Uses WebRTC data channels for lightweight peer-to-peer communication in the browser
Pure JavaScript
No native dependencies, works everywhere JavaScript runs
Protocol Extensions
Supports magnet URIs, DHT, trackers, LSD, and peer exchange
Fast & Efficient
Download multiple torrents simultaneously with intelligent piece selection
How It Works
WebTorrent is the first BitTorrent client that works in the browser, using open web standards (no plugins, just HTML5 and WebRTC). To make BitTorrent work over WebRTC (which is the only P2P transport that works on the web), we made some protocol changes. Therefore, a browser-based WebTorrent client or “web peer” can only connect to other clients that support WebRTC.
Quick Example
Get started with WebTorrent in just a few lines of code:Next Steps
Installation
Install WebTorrent via npm or use it directly in the browser
Quickstart
Get up and running with your first torrent in minutes
API Reference
Explore the complete WebTorrent API documentation
Examples
See real-world examples and use cases
Browser/WebRTC Features
- WebRTC data channels for lightweight peer-to-peer communication with no plugins
- No silos. WebTorrent is a P2P network for the entire web. WebTorrent clients running on one domain can connect to clients on any other domain
- Stream video torrents into a
<video>tag (webm, mkv, mp4, ogv, mov, etc with AV1, H264, HEVC, VP8, VP9, AAC, FLAC, MP3, OPUS, Vorbis support) - Supports Chrome, Firefox, Opera, and Safari
Who’s Using WebTorrent?
WebTorrent is used by popular applications including:- Instant.io - Streaming file transfer over WebTorrent
- WebTorrent Desktop - Beautiful desktop torrent client for Mac, Windows, and Linux
- PeerTube - Decentralized video streaming platform
- Brave Browser - Privacy-focused browser with built-in torrent support