WebTorrent Workshop

00 - Include WebTorrent in a page

WebTorrent is the first torrent client that works in the browser. In this workshop you will learn how to download a torrent and view it in the browser.

Start by including the WebTorrent library in a webpage.

Tips

We recommend using CodePen to work through the workshop (to save time setting up a local environment).

To start using WebTorrent, simply include the webtorrent.min.js script on your page.

<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js"></script>

This provides a WebTorrent function on the global window object.

Log out the version of WebTorrent currently in use.

console.log(WebTorrent.VERSION)

Verify

Open the browser console and confirm that you see the output we printed. If it worked correctly, you should see the following output (or something similar):

0.108.5

Note: If there are other warning or errors generated by the CodePen site, you can probably ignore those.

Congrats, you’ve made the first step to downloading a torrent in the browser.

If you are stuck, read the solution.

When you are ready, go to the next exercise.