Giter VIP home page Giter VIP logo

Comments (3)

feross avatar feross commented on May 15, 2024

One simple way to do this with the existing API is:

var parseTorrent = require('parse-torrent')

var torrent = fs.readFileSync(__dirname + '/torrents/bitlove-intro.torrent')
var parsedTorrent = parseTorrent(torrent)
parsedTorrent.announce.push('udp://tracker.publicbt.com:80/announce')
parsedTorrent.announce.push('...')

var client = new Client(peerId, port, parsedTorrent)

Does this work for you?

from bittorrent-tracker.

arestov avatar arestov commented on May 15, 2024

Yes, it does :) I solve this problem in a little other way since I want to reuse parsedTorrent object. (If I do so it is possible that I will append my trackers again, again and again. So I clone and concat)

var torrent_ft = util._extend({}, parsedTorrent);
var trackers_list = [];
[torrent_ft.announce, opts.trackers].forEach(function(array) {
    if (array) {
        trackers_list = trackers_list.concat(array);
    }
});
torrent_ft.announce = trackers_list;

Yes, It is not really necessary thing :)

from bittorrent-tracker.

feross avatar feross commented on May 15, 2024

Cool, glad it works for you! If someone else wants this too we can just add it to the API. It would be really simple to add.

from bittorrent-tracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.