你可以将WebTorrent理解为一个针对整个web的P2P网络,在一个域内运行的WebTorrent客户端可以连接到任何其他域上的客户端,从而达到分布式的效果,进而完成高速的文件分享传输。
作为一个开源项目,WebTorrent还准备了丰富的教程文档用来指因新手用户使用:
例如指引用户如何将WebTorrent与视频播放器集成
也会给出如何在浏览器中下载torrent 的快速示例:
const WebTorrent = require(‘webtorrent’)
const client = new WebTorrent()
// Sintel, a free, Creative Commons movie
const torrentId = ‘magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torre