{"id":21385263,"url":"https://github.com/mikhailvs/torrent-ruby","last_synced_at":"2025-07-13T15:30:25.192Z","repository":{"id":148153060,"uuid":"2050184","full_name":"mikhailvs/torrent-ruby","owner":"mikhailvs","description":"A Ruby library for dealing with .torrent files and trackers.","archived":false,"fork":false,"pushed_at":"2014-02-16T23:53:54.000Z","size":2835,"stargazers_count":46,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-27T15:52:06.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikhailvs.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-07-14T22:24:29.000Z","updated_at":"2023-03-27T16:15:38.186Z","dependencies_parsed_at":"2023-03-27T16:15:38.005Z","dependency_job_id":null,"html_url":"https://github.com/mikhailvs/torrent-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Ftorrent-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Ftorrent-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Ftorrent-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikhailvs%2Ftorrent-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikhailvs","download_url":"https://codeload.github.com/mikhailvs/torrent-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225893390,"owners_count":17540914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T11:46:17.520Z","updated_at":"2024-11-22T11:46:18.032Z","avatar_url":"https://github.com/mikhailvs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Ruby library for dealing with .torrent files and trackers.\n\nExamples:\n  require 'torrent-ruby'\n\n  # bencoding data\n  {'a' =\u003e 'animal', 'b' =\u003e ['banana', 'bologna', 42]}.bencode\n  #=\u003e \"d1:a6:animal1:bl6:banana7:bolognai42eee\"\n\n  # bdecoding data\n  \"ld3:one1:a3:two1:b5:threei3eed4:fourd4:five3:sixeee\".bdecode\n  #=\u003e [{\"one\"=\u003e\"a\", \"two\"=\u003e\"b\", \"three\"=\u003e3}, {\"four\"=\u003e{\"five\"=\u003e\"six\"}}]\n\n  # get a TorrentFile object from a torrent file\n  file = TorrentFile.open 'somefile.torrent'\n  \n  # get original contents of file\n  file.bencoded #=\u003e some bencoded string\n\n  # get dictionary from .torrent file as ruby hash\n  file.to_h #=\u003e dictionary from .torrent file\n\n  # save as new .torrent file\n  file.save 'newname.torrent'\n\n  # initialize a TrackerHandler object\n  handler = TrackerHandler.new( TorrentFile.open('somefile.torrent'),\n                               :tracker_timeout =\u003e 5, :port =\u003e 42309)\n\n  # get list of available trackers (as an array)\n  trackers = handler.trackers\n\n  # establish connection to tracker from index of a tracker\n  # from the above 'trackers' array\n  success = handler.establish_connection 0\n  connected_tracker = handler.connected_trackers.last\n\n  # send request to a connected tracker\n  if success\n    response = handler.request( :uploaded =\u003e 1, :downloaded =\u003e 10,\n              :left =\u003e 100, :compact = 0,\n              :no_peer_id =\u003e 0, :event =\u003e 'started',\n              :index =\u003e 0)\n  end\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikhailvs%2Ftorrent-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikhailvs%2Ftorrent-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikhailvs%2Ftorrent-ruby/lists"}