{
  "name": "parse-torrent",
  "description": "Parse a torrent and return an object of keys/values",
  "version": "1.4.0",
  "author": {
    "name": "Feross Aboukhadijeh",
    "email": "feross@feross.org",
    "url": "http://feross.org/"
  },
  "bin": {
    "parse-torrent": "./bin/cmd.js"
  },
  "bugs": {
    "url": "https://github.com/feross/parse-torrent/issues"
  },
  "dependencies": {
    "bencode": "^0.6.0",
    "rusha-browserify": "^0.7.3"
  },
  "devDependencies": {
    "brfs": "^1.0.0",
    "tape": "^2.5.0"
  },
  "homepage": "https://github.com/feross/parse-torrent",
  "keywords": [
    "torrent",
    "parse torrent",
    "read torrent",
    ".torrent",
    "peer-to-peer",
    "bittorrent",
    "bittorrent",
    "webtorrent"
  ],
  "license": "MIT",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "git://github.com/feross/parse-torrent.git"
  },
  "scripts": {
    "test": "tape test/*.js"
  },
  "testling": {
    "files": "test/*.js",
    "browsers": [
      "ie/10..latest",
      "chrome/25..latest",
      "firefox/20..latest",
      "safari/6..latest",
      "opera/15.0..latest"
    ]
  },
  "readme": "# parse-torrent [![travis](https://img.shields.io/travis/feross/parse-torrent.svg)](https://travis-ci.org/feross/parse-torrent) [![npm](https://img.shields.io/npm/v/parse-torrent.svg)](https://npmjs.org/package/parse-torrent) [![downloads](https://img.shields.io/npm/dm/parse-torrent.svg)](https://npmjs.org/package/parse-torrent) [![gittip](https://img.shields.io/gittip/feross.svg)](https://www.gittip.com/feross/)\n\n#### Parse a torrent file and return an object of keys/values.\n\n[![browser support](https://ci.testling.com/feross/parse-torrent.png)](https://ci.testling.com/feross/parse-torrent)\n\n\nAlso works in the browser with [browserify](http://browserify.org/)! Works well with the buffers returned from [bencode](https://www.npmjs.org/package/bencode).\n\nThis module is used by [WebTorrent](http://webtorrent.io).\n\n## install\n\n```\nnpm install parse-torrent\n```\n\n## usage\n\n```js\nvar parseTorrent = require('parse-torrent')\n\nvar torrent = fs.readFileSync(__dirname + '/torrents/leaves.torrent')\nvar parsed\ntry {\n  parsed = parseTorrent(torrent)\n} catch (e) {\n  // the torrent file was corrupt\n  console.error(e)\n}\n\nconsole.log(parsed.name) // Prints \"Leaves of Grass by Walt Whitman.epub\"\n```\n\nThe `parsed` torrent object 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\nTo convert a parsed torrent back into a .torrent file buffer, call `parseTorrent.toBuffer`.\n\n```js\nvar parseTorrent = require('parse-torrent')\n\n// parse a torrent\nvar parsed = parseTorrent(/* some buffer */)\n\n// convert parsed torrent back to a buffer\nvar buf = parseTorrent.toBuffer(parsed)\n```\n\n## credit\n\nThis was originally based on [read-torrent](https://www.npmjs.org/package/read-torrent) by [mafintosh](https://twitter.com/mafintosh). It's basically a pared-down version of that, but it works in the browser (so [WebTorrent](http://webtorrent.io) can use it), doesn't have huge npm dependencies like `request` (saving on file size), and it has tests. Thanks for publishing good modules, mafintosh!\n\n## license\n\nMIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).\n",
  "readmeFilename": "README.md",
  "_id": "parse-torrent@1.4.0",
  "_shasum": "99365b6c9ca017a61e5e6877135fafdf78b0f7a7",
  "_from": "parse-torrent@^1.4.0",
  "_resolved": "https://registry.npmjs.org/parse-torrent/-/parse-torrent-1.4.0.tgz"
}
