INNER CODE UNIT · JavaScript

onFiles

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

function onFiles (files) {
  debug('got files:')
  files.forEach(function (file) {
    debug(' - %s (%s bytes)', file.name, file.size)
  })

  // .torrent file = start downloading the torrent
  files.filter(isTorrentFile).forEach(downloadTorrentFile)

  // everything else = seed these files
  seed(files.filter(isNotTorrentFile))
}

function isTorrentFile (file) {
  const extname = path.extname(file.name).toLowerCase()
  return extname === '.torrent'
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…