Instead of just giving the user individual file download links, what if they could click once and automatically get a. You can solve this by encrypting the file data before calling ed so even if a rougue peer were to join the swarm, they won’t be able to read the data. It is possible for a malicious tracker server to join the peer swarm and start downloading the torrent from your users. Even though file data is only ever sent between peers and it never goes through a central server, the WebTorrent tracker servers which help peers connect to each other are aware of the magnet links which are in use. For an example of this in action, try visiting this link.
To shorten the URL even further, you can just include the “info hash” rather than the full magnet link and WebTorrent will automatically convert it into a magnet link. Instead of requiring the user sharing the file to share a magnet link, what if they could just copy a URL and send it to their friend? The URL could contain the full magnet link within it and the site could automatically begin downloading the magnet link that’s included in the URL. You’ll want to take a look at the date-fns formatDistance function which helps you generate these friendly English phrases.Īdd share URLs. For example, “2 minutes remaining” or “Less than 10 seconds remaining”. Instead of just showing progress (like 5% or 95%), it would be nice to show an estimate of remaining download time in plain English. Can you hide certain information from the user to make it friendlier? Can you add animations or other UX flourishes to make the site more fun to use? One file sharing site that uses WebTorrent and has a nice UX is File.pizza. Right now the site is very simple and quite technical. Here is a list of ideas to make your site more useful: You should spend some time now adding enhancements to your file sharing site. Unlike traditional web server architectures which slow down the more users they get, WebTorrent-powered sites get faster and more resilient the more users who join.
Very powerful! And you didn’t need to write any extra code to get this behavior. The initial sharer of the file won’t have to do all of the work sending 100 individual copies of the file to each of the 100 people who want it. Any peer which has a piece of the file will be able to share it with other peers that don’t have it yet. Seriously nice work!įurthermore, since the site is powered by the WebTorrent protocol, you automatically get swarming behavior, which means that if one person wants to share a file to 100 people (say by tweeting it out to your followers), it will scale very well. In around 100 lines of code you were able to build a powerful website that delivers files directly between users using peer-to-peer WebRTC technology, without sending the files through a central server. WebTorrent Workshop 10 - Explore on your ownĬongrats on building your own file sharing website using WebTorrent!