{"id":13482282,"url":"https://github.com/mafintosh/read-torrent","last_synced_at":"2025-04-14T10:33:16.613Z","repository":{"id":7439609,"uuid":"8779697","full_name":"mafintosh/read-torrent","owner":"mafintosh","description":"read and parse a torrent from a resource","archived":false,"fork":false,"pushed_at":"2018-11-21T06:52:43.000Z","size":19,"stargazers_count":73,"open_issues_count":1,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-29T14:27:40.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mafintosh.png","metadata":{"files":{"readme":"README.md","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":"2013-03-14T16:23:02.000Z","updated_at":"2024-10-12T23:46:52.000Z","dependencies_parsed_at":"2022-08-26T20:45:31.387Z","dependency_job_id":null,"html_url":"https://github.com/mafintosh/read-torrent","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fread-torrent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fread-torrent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fread-torrent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafintosh%2Fread-torrent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mafintosh","download_url":"https://codeload.github.com/mafintosh/read-torrent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248862791,"owners_count":21173883,"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-07-31T17:01:00.527Z","updated_at":"2025-04-14T10:33:16.592Z","avatar_url":"https://github.com/mafintosh.png","language":"JavaScript","funding_links":[],"categories":["Modules","JavaScript"],"sub_categories":[],"readme":"# read-torrent\n\nRead and parse a torrent from a resource\n\n\tnpm install read-torrent\n\n## Usage\n\n``` js\nvar readTorrent = require('read-torrent');\n\nreadTorrent('http://my-server.com/file.torrent', options, function(err, torrent) {\n\t// we loaded a torrent from a server\n});\n\nreadTorrent('mydir/file.torrent', function(err, torrent) {\n\t// we loaded a torrent from a file\n});\n```\nwhere `options` is a javascript object with [request](https://www.npmjs.com/package/request) options\n\nThe torrent result looks like this:\n\n``` js\n{\n  infoHash: 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36',\n  name: 'Leaves of Grass by Walt Whitman.epub',\n  private: false,\n  created: new Date('Thu Aug 01 2013 06:27:46 GMT-0700 (PDT)'),\n  announce: [\n    'http://tracker.thepiratebay.org/announce',\n    'udp://tracker.openbittorrent.com:80',\n    'udp://tracker.ccc.de:80',\n    'udp://tracker.publicbt.com:80',\n    'udp://fr33domtracker.h33t.com:3310/announce'\n  ],\n  files: [\n    {\n      path: 'Leaves of Grass by Walt Whitman.epub',\n      name: 'Leaves of Grass by Walt Whitman.epub',\n      length: 362017,\n      offset: 0\n    }\n  ],\n  length: 362017,\n  pieceLength: 16384,\n  lastPieceLength: 1569,\n  pieces: [\n    '1f9c3f59beec079715ec53324bde8569e4a0b4eb',\n    'ec42307d4ce5557b5d3964c5ef55d354cf4a6ecc',\n    '7bf1bcaf79d11fa5e0be06593c8faafc0c2ba2cf',\n    '76d71c5b01526b23007f9e9929beafc5151e6511',\n    '0931a1b44c21bf1e68b9138f90495e690dbc55f5',\n    '72e4c2944cbacf26e6b3ae8a7229d88aafa05f61',\n    'eaae6abf3f07cb6db9677cc6aded4dd3985e4586',\n    '27567fa7639f065f71b18954304aca6366729e0b',\n    '4773d77ae80caa96a524804dfe4b9bd3deaef999',\n    'c9dd51027467519d5eb2561ae2cc01467de5f643',\n    '0a60bcba24797692efa8770d23df0a830d91cb35',\n    'b3407a88baa0590dc8c9aa6a120f274367dcd867',\n    'e88e8338c572a06e3c801b29f519df532b3e76f6',\n    '70cf6aee53107f3d39378483f69cf80fa568b1ea',\n    'c53b506159e988d8bc16922d125d77d803d652c3',\n    'ca3070c16eed9172ab506d20e522ea3f1ab674b3',\n    'f923d76fe8f44ff32e372c3b376564c6fb5f0dbe',\n    '52164f03629fd1322636babb2c014b7dae582da4',\n    '1363965261e6ce12b43701f0a8c9ed1520a70eba',\n    '004400a267765f6d3dd5c7beb5bd3c75f3df2a54',\n    '560a61801147fa4ec7cf568e703acb04e5610a4d',\n    '56dcc242d03293e9446cf5e457d8eb3d9588fd90',\n    'c698de9b0dad92980906c026d8c1408fa08fe4ec'\n  ]\n}\n```\n\nFor convenience, `read-torrent` also support reading magnet uri. Resulting information is limited, though.\n\n``` js\n// \"Leaves of Grass\" by Walt Whitman\nvar uri = 'magnet:?xt=urn:btih:d2474e86c95b19b8bcfdb92bc12c9d44667cfa36\u0026dn=Leaves+of+Grass+by+Walt+Whitman.epub\u0026tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80\u0026tr=udp%3A%2F%2Ftracker.publicbt.com%3A80\u0026tr=udp%3A%2F%2Ftracker.istole.it%3A6969\u0026tr=udp%3A%2F%2Ftracker.ccc.de%3A80\u0026tr=udp%3A%2F%2Fopen.demonii.com%3A1337'\n\nreadTorrent(uri, function(err, torrent) {\n  // we loaded a torrent from a magnet uri\n});\n```\n\nResulting information depends on the contents of the URI, but `infoHash` is guaranteed for any valid magnet uri.\n\n## Command-line interface\n\nThere is also a command-line interface available if you install it with `-g`\n\n\tnpm install -g read-torrent\n\nThis installs a program called `read-torrent` that you simply pass a torrent file or url\n\n\tread-torrent http://my-server.com/file.torrent\n\nThis will print all meta info of the torrent file to the terminal\n\n## Comments\n\nThanks to https://github.com/feross for `parse-torrent` and `magnet-uri`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafintosh%2Fread-torrent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmafintosh%2Fread-torrent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafintosh%2Fread-torrent/lists"}