# webtorrent
**Repository Path**: sdswxw/webtorrent
## Basic Information
- **Project Name**: webtorrent
- **Description**: WebTorrent 是一个用于 node.js 和浏览器的流式 Torrent 客户端
- **Primary Language**: JavaScript
- **License**: MIT
- **Default Branch**: master
- **Homepage**: https://www.oschina.net/p/webtorrent
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 5
- **Created**: 2024-02-05
- **Last Updated**: 2024-02-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
WebTorrent
The streaming torrent client. For node.js and the web.
Sponsored by
**WebTorrent** is a streaming torrent client for **node.js** and the **browser**. YEP,
THAT'S RIGHT. 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™. Note: WebTorrent does **not** support UDP/TCP peers in browser.
Simply include the
[`webtorrent.min.js`](https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js) script
on your page to start fetching files over WebRTC using the BitTorrent protocol, or
`import WebTorrent from 'webtorrent'` with [browserify](http://browserify.org/) or [webpack](https://webpack.js.org/). See [demo apps
](#who-is-using-webtorrent-today) and [code examples](#usage) below.
[](https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js)
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 WebTorrent/WebRTC.
To seed files to web peers, use a client that supports WebTorrent, e.g.
[WebTorrent Desktop][webtorrent-desktop], a desktop client with a
familiar UI that can connect to web peers,
[webtorrent-hybrid](https://github.com/webtorrent/webtorrent-hybrid), a command line program,
or [Instant.io](https://instant.io/), a website. Established torrent clients like
**Vuze** have [already added WebTorrent support](https://wiki.vuze.com/w/WebTorrent) so
they can connect to both normal *and* web peers. We hope other clients will follow.

### Features
- **Torrent client for node.js & the browser** (same npm package!)
- **Insanely fast**
- Download **multiple torrents** simultaneously, efficiently
- **Pure Javascript** (no native dependencies)
- Exposes files as **streams**
- Fetches pieces from the network on-demand so seeking is supported (even before torrent is finished)
- Seamlessly switches between sequential and rarest-first piece selection strategy
- Supports advanced torrent client features
- **magnet uri** support via **[ut_metadata](https://github.com/webtorrent/ut_metadata)**
- **peer discovery** via **[dht](https://github.com/webtorrent/bittorrent-dht)**,
**[tracker](https://github.com/webtorrent/bittorrent-tracker)**,
**[lsd](https://github.com/webtorrent/bittorrent-lsd)**, and
**[ut_pex](https://github.com/webtorrent/ut_pex)**
- **[protocol extension api](https://github.com/webtorrent/bittorrent-protocol#extension-api)**
for adding new extensions
- **Comprehensive test suite** (runs completely offline, so it's reliable and fast)
- Check all the **[supported BEPs here](docs/bep_support.md)**
#### Browser/WebRTC environment 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 `