INNER CODE UNIT · JavaScript

onTorrent

webtorrent/instant.io · client/index.js:176

function onTorrent (torrent) {
  torrent.on('warning', util.warning)
  torrent.on('error', util.error)

  const upload = document.querySelector('input[name=upload]')
  upload.value = upload.defaultValue // reset upload element

  const torrentFileName = path.basename(torrent.name, path.extname(torrent.name)) + '.torrent'

  util.log('"' + torrentFileName + '" contains ' + torrent.files.length + ' files:')

  torrent.files.forEach(function (file) {
    util.unsafeLog('  - ' + escapeHtml(file.name) + ' (' + escapeHtml(prettierBytes(file.length)) + ')')
  })

  util.log('Torrent info hash: ' + torrent.infoHash)
  util.unsafeLog(
    '<a href="/#' + escapeHtml(torrent.infoHash) + '" onclick="prompt(\'Share this link with anyone you want to download this torrent:\', this.href);return false;">[Share link]</a> ' +

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…