GitHub is highly praised as an open source download tool that can replace Xunlei

Hello, I'm TJ

An inspirational programmer who recommends 10000 open source projects and tools

Today, TJ Jun felt old in a diving group. It turned out that today's young people don't know what Xunlei and magnetic link are!

However, for TJ Jun's generation, Xunlei may represent an era and a memory, so today we will introduce an open-source imitation Xunlei tool, WebTorrent

Strictly speaking, WebTorrent is not exactly a product imitating Xunlei. It is more like an enhanced version of Xunlei. Xunlei has some functions, but some Xunlei may not have them. Just like LeBron James, those stronger than him are not as fast as him, and those faster than him are not as strong as him.

WebTorrent is written in JavaScript language and realizes point-to-point transmission. It can not only be directly used as a BT download tool, but also be broadcast like Xunlei.

Because WebTorrent also supports BitTorrent transport protocol, like other BT download tools or, you are also transmitting and sharing data to others while downloading.

And because WebTorrent is completely completed by JavaScript language, it can be opened and used directly in the browser without downloading the client. TJ Jun's impression should be that this is the first download tool to be implemented in this way.

WebTorrent can efficiently complete file transfer directly on the browser side and broadcast while playing. Based on its adoption of WebRTC technology, WebTorrent will never make the younger generation who are used to only watching online playback feel uncomfortable.

You can understand WebTorrent as a P2P network for the whole web. WebTorrent clients running in one domain can connect to clients in any other domain, so as to achieve distributed effect and complete high-speed file sharing and transmission.

As an open source project, WebTorrent has also prepared rich tutorial documents to refer to novice users:

For example, guide users how to integrate WebTorrent with video player

<!DOCTYPE html>
    <title>Web Torrent Tutorial</title>
    <meta charset="UTF-8" />
    <script src="//"></script>
    <video id="video-container" controls="true"></video>
      const client = new WebTorrent();
      const torrentId =

      client.add(torrentId, function (torrent) {
        // Torrents can contain many files. Let's use the .mp4 file
        const file = torrent.files.find(function (file) {

        // Render to a <video> element by providing an ID. Alternatively, one can also provide a DOM element.
        file.renderTo("#video-container", {}, () => {
          console.log("Ready to play!");

It also gives a quick example of how to download torrent in the browser:

const WebTorrent = require('webtorrent')

const client = new WebTorrent()

// Sintel, a free, Creative Commons movie
const torrentId = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&'

client.add(torrentId, function (torrent) {
  // Torrents can contain many files. Let's use the .mp4 file
  const file = torrent.files.find(function (file) {

  // Display the file by adding it to the DOM.
  // Supports video, audio, image files, and more!

If you want to study, collect and use Yibo for the first time, hurry to get the warehouse address:

Click on the bottom card to pay attention to the official account "TJ Jun".

Reply "look down" to get the warehouse address

Pay attention to me and know a cow x, easy-to-use and interesting thing every day

Posted on Tue, 09 Nov 2021 23:21:59 -0500 by Rob the R