How to use the webtorrent-fixtures.sintel 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 / webtorrent-cli / test / basic.js View on Github external
test('Command line: webtorrent downloadmeta ', t => {
  t.plan(2)

  const fixturesPath = path.join(path.dirname(require.resolve('webtorrent-fixtures')), 'fixtures')

  cp.exec(`${CMD} downloadmeta '${fixtures.sintel.magnetURI}' --out ${fixturesPath}`, (err, data) => {
    t.error(err)
    const parsedTorrent = parseTorrent(fs.readFileSync(`${fixturesPath}/${fixtures.sintel.parsedTorrent.infoHash}.torrent`))
    // Sintel torrent file contain two fields not availaible from the DHT
    const expectedTorrent = fixtures.sintel.parsedTorrent
    delete expectedTorrent.created
    delete expectedTorrent.createdBy
    t.deepEqual(parsedTorrent, expectedTorrent)
  })
})
github webtorrent / webtorrent-cli / test / basic.js View on Github external
cp.exec(`${CMD} downloadmeta '${fixtures.sintel.magnetURI}' --out ${fixturesPath}`, (err, data) => {
    t.error(err)
    const parsedTorrent = parseTorrent(fs.readFileSync(`${fixturesPath}/${fixtures.sintel.parsedTorrent.infoHash}.torrent`))
    // Sintel torrent file contain two fields not availaible from the DHT
    const expectedTorrent = fixtures.sintel.parsedTorrent
    delete expectedTorrent.created
    delete expectedTorrent.createdBy
    t.deepEqual(parsedTorrent, expectedTorrent)
  })
})
github webtorrent / bittorrent-tracker / test / client-large-torrent.js View on Github external
common.createServer(t, serverType, function (server, announceUrl) {
    var client = new Client({
      infoHash: fixtures.sintel.parsedTorrent.infoHash,
      peerId: peerId,
      port: 6881,
      announce: announceUrl,
      wrtc: {}
    })

    if (serverType === 'ws') common.mockWebsocketTracker(client)
    client.on('error', function (err) { t.error(err) })
    client.on('warning', function (err) { t.error(err) })

    client.once('update', function (data) {
      t.equal(data.announce, announceUrl)
      t.equal(typeof data.complete, 'number')
      t.equal(typeof data.incomplete, 'number')

      client.update()