How to use the webtorrent-fixtures.sintel.torrent function in webtorrent-fixtures

To help you get started, we’ve selected a few webtorrent-fixtures examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webtorrent / ut_metadata / test / fetch.js View on Github external
test('fetch() large torrent', t => {
  t.plan(4)

  const wire1 = new Protocol()
  const wire2 = new Protocol()
  wire1.pipe(wire2).pipe(wire1)

  wire1.use(utMetadata(sintel.torrent)) // wire1 already has metadata
  wire2.use(utMetadata()) // wire2 does not

  wire2.ut_metadata.fetch()

  wire2.ut_metadata.on('metadata', _metadata => {
    // got metadata!
    t.equal(
      _metadata.toString('hex'),
      bencode.encode({
        info: bencode.decode(sintel.torrent).info
      }).toString('hex')
    )
  })

  wire2.on('handshake', (infoHash, peerId, extensions) => {
    wire2.handshake(sintel.parsedTorrent.infoHash, id2)
github webtorrent / ut_metadata / test / fetch.js View on Github external
wire2.ut_metadata.on('metadata', _metadata => {
    // got metadata!
    t.equal(
      _metadata.toString('hex'),
      bencode.encode({
        info: bencode.decode(sintel.torrent).info
      }).toString('hex')
    )
  })