RubyTorrent: BitTorrent for Ruby

RubyTorrent is a pure-Ruby BitTorrent peer library and toolset. You can use it to download or serve files over BitTorrent from any Ruby program. RubyTorrent is released under the GNU GPL.

Note that RubyTorrent doesn't include a tracker, although plans are in the works. Nor does it include a fancy client program (though it does include a reasonable one, mostly for debugging). At this point, it's "only" a BitTorrent peer and tracker communication library.

Synopsis

## world's smallest bittorrent client
require 'rubytorrent'
bt = RubyTorrent::BitTorrent.new(ARGV.shift)
 
thread = Thread.new do
  while true
    puts bt.percent_completed
    sleep 15
  end
end
bt.on_event(self, :complete) { thread.kill }
thread.join

Documentation

Documentation for the 0.3 release is available as doc/api.txt.

Status

The current version of RubyTorrent is 0.3, released February 12th, 2005. This is a beta release. BitTorrent downloads/uploads work fine, and speed seems comparable with that of other clients, but more tests and comparisons are needed. The API is pretty simple and clean, but I'm not going to make any guarantee of API stability just yet.

More info

You can download RubyTorrent releases from the RubyTorrent RubyForge page. The mailing list for RubyTorrent is rubytorrent-devel. Feel free to post comments, bug reports and patches.

Author

RubyTorrent is brought to you by William Morgan, and by a phalanx of contributors like you.