client.seed(filePath, torrent => { console.log('torrentId (info hash):', torrent.infoHash) // console.log('torrentId (magnet link):', torrent.magnetURI) })
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) }) }