<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="//cdn.jsdelivr.net/webtorrent/0.27.2/webtorrent.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<h1>Webtorrent example</h1>
</body>
</html>
var client = new WebTorrent()
var torrentUri = 'http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso.torrent'
console.log("running");
client.add(torrentUri, function(torrent) {
// Got torrent metadata!
console.log('Torrent info hash:', torrent.infoHash)
torrent.files.forEach(function(file) {
// Get a url for each file
file.getBlobURL(function(err, url) {
if (err) throw err
// Add a link to the page
var a = document.createElement('a')
a.download = file.name
a.href = url
a.textContent = 'Download ' + file.name
document.body.appendChild(a)
})
})
})
/* Styles go here */