How to use the create-torrent.announceList.map function in create-torrent

To help you get started, we’ve selected a few create-torrent 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-desktop / src / renderer / webtorrent.js View on Github external
const WebTorrent = require('webtorrent')
const zeroFill = require('zero-fill')

const crashReporter = require('../crash-reporter')
const config = require('../config')
const { TorrentKeyNotFoundError } = require('./lib/errors')
const torrentPoster = require('./lib/torrent-poster')

// Report when the process crashes
crashReporter.init()

// Send & receive messages from the main window
const ipc = electron.ipcRenderer

// Force use of webtorrent trackers on all torrents
global.WEBTORRENT_ANNOUNCE = defaultAnnounceList
  .map((arr) => arr[0])
  .filter((url) => url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0)

/**
 * WebTorrent version.
 */
const VERSION = require('../../package.json').version

/**
 * Version number in Azureus-style. Generated from major and minor semver version.
 * For example:
 *   '0.16.1' -> '0016'
 *   '1.2.5' -> '0102'
 */
const VERSION_STR = VERSION.match(/([0-9]+)/g)
  .slice(0, 2)
github MovieCast / desktop / src / renderer / torrentEngine.js View on Github external
*/

import { ipcRenderer as ipc } from 'electron';
// import TorrentEngine from '../main/TorrentEngine';
import crypto from 'crypto';
// import { EventEmitter } from 'events';
import { announceList } from 'create-torrent';
import WebTorrent from 'webtorrent';
import zeroFill from 'zero-fill';
import networkAddress from 'network-address';
import pkg from '../package.json';

console.time('init');

// Force use of webtorrent trackers on all torrents
global.WEBTORRENT_ANNOUNCE = announceList
  .map((arr) => arr[0])
  .filter((url) => url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0);

/**
 * Version number in Azureus-style. Generated from major and minor semver version.
 * For example:
 *   '0.0.1' -> '0000'
 *   '0.1.0' -> '0001'
 *   '1.1.0' -> '0101'
 */
const VERSION = pkg.version;

/**
 * Version prefix string (used in peer ID). MovieCast uses the Azureus-style
 * encoding: '-', two characters for client id ('MC'), four ascii digits for version
 * number, '-', followed by random numbers.
github MovieCast / desktop / src / main / TorrentEngine.js View on Github external
import WebTorrent from 'webtorrent';
import zeroFill from 'zero-fill';
import networkAddress from 'network-address';
import pkg from '../package.json';
import {
  torrentWarning,
  torrentError,
  torrentInfoHash,
  torrentMetaData,
  torrentProgress,
  torrentDone,
  streamServerStarted
} from '../shared/actions/torrent';

// Force use of webtorrent trackers on all torrents
global.WEBTORRENT_ANNOUNCE = announceList
  .map((arr) => arr[0])
  .filter((url) => url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0);


/**
 * Manager for WebTorrent
 *
 * A lot of the code here is inspired
 * by WebTorrent Desktop
 *
 * @todo
 * The torrent engine causes the UI to lagg
 * In order to fix this the torrent engine should
 * move to it's own window
 */
class TorrentEngine {
github MovieCast / desktop / src / main / streamer.js View on Github external
getInstance() {
    if (this.client === null) {
      const announce = announceList
        .map((arr) => arr[0])
        .filter((url) => url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0);

      this.client = new WebTorrent({
        peerId: Streamer.PEER_ID,
        tracker: { announce }
      });
    }
    return this.client;
  }
}

create-torrent

Create .torrent files

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis