WebTorrent is a torrent client implemented in JavaScript that runs in Node.js with TCP and UDP peers, and in the browser over WebRTC. The same npm package targets both environments for fetching and seeding torrents.
Overview
WebTorrent lets applications download and stream torrents without native plugins in the browser, using WebRTC data channels for peer transport where UDP and TCP are unavailable. In Node.js it behaves as a conventional torrent client while sharing most of the same code path.
Files are exposed as streams with on-demand piece fetching, so playback can start before a download completes and seeking is supported. The client can manage multiple torrents, switch piece selection strategies, and interoperates with extensions such as DHT, local service discovery, and uTPex when those modules are enabled.
Browser peers use protocol adjustments compatible only with other WebTorrent-capable clients. Companion projects include a desktop application, a hybrid Node build with WebRTC, a CLI, and public demo sites for trying transfers in the browser.
Developers integrate by importing the package in bundled front-end code, loading a standalone script, or requiring it in Node. Optional modules split trackers, magnet parsing, torrent creation, and related BitTorrent plumbing into separate packages maintained alongside the core client.
Key features
- Browser torrents via WebRTC
- Node.js TCP and UDP peers
- On-demand streaming from torrents
- Concurrent multi-torrent downloads
- Pure JavaScript implementation
- DHT and tracker discovery support
- Video streaming into HTML media tags
- Chrome, Firefox, Opera, and Safari support
Use cases
- In-browser file sharing demos
- Streaming video while torrents download
- Node apps that fetch torrent content
- Sites that seed files to web peers