client.on('error', function (err) { console.error('Error: ' + err.message) loading.style.display = 'none'; alert('An error occured. Please try again.') location.reload() })
function runSeed (input) { if (path.extname(input).toLowerCase() === '.torrent' || /^magnet:/.test(input)) { // `webtorrent seed` is meant for creating a new torrent based on a file or folder // of content, not a torrent id (.torrent or a magnet uri). If this command is used // incorrectly, let's just do the right thing. runDownload(input) return } const client = new WebTorrent({ blocklist: argv.blocklist }) client.on('error', fatalError) client.seed(input, { announce: argv.announce, torrentPort: argv['torrent-port'], dhtPort: argv['dht-port'] }, torrent => { if (argv.quiet) { console.log(torrent.magnetURI) } drawTorrent(torrent) }) }