{
  "name": "bencode",
  "version": "0.6.0",
  "license": "MIT",
  "description": "Bencode de/encoder",
  "keywords": [
    "torrent",
    "bittorrent",
    "bencode",
    "bdecode",
    "bencoding"
  ],
  "contributors": [
    {
      "name": "Mark Schmale",
      "email": "masch@masch.it",
      "url": "http://masch.it/"
    },
    {
      "name": "Jonas Hermsmeier",
      "email": "jonas@hojoki.com"
    }
  ],
  "main": "bencode.js",
  "devDependencies": {
    "matcha": "",
    "bencoding": "",
    "dht-bencode": "",
    "bncode": "",
    "dht.js": "",
    "tape": "~2.12"
  },
  "scripts": {
    "test": "node node_modules/tape/bin/tape test/*.test.js",
    "bench": "node node_modules/matcha/bin/matcha benchmark/*.js"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/themasch/node-bencode.git"
  },
  "bugs": {
    "url": "https://github.com/themasch/node-bencode/issues"
  },
  "testling": {
    "files": "test/*.test.js",
    "browsers": [
      "ie/6..latest",
      "chrome/22..latest",
      "firefox/16..latest",
      "safari/latest",
      "opera/11.0..latest",
      "iphone/6..latest",
      "ipad/6..latest",
      "android-browser/latest"
    ]
  },
  "readme": "# node-bencode [![build status](https://secure.travis-ci.org/themasch/node-bencode.png)](http://travis-ci.org/themasch/node-bencode) [![NPM version](https://badge.fury.io/js/bencode.png)](https://npmjs.org/package/bencode)\n\nA node library for encoding and decoding bencoded data,\naccording to the [BitTorrent specification](http://www.bittorrent.org/beps/bep_0003.html).\n\n## Index\n\n- [About BEncoding](#about-bencoding)\n- [Installation](#install-with-npm)\n- [Performance](#performance)\n- [Usage](#usage)\n- [API](#api)\n\n## About BEncoding\n\nfrom [Wikipedia](https://en.wikipedia.org/wiki/Bencoding):\n\nBencode (pronounced like B encode) is the encoding used by the peer-to-peer\nfile sharing system BitTorrent for storing and transmitting loosely structured data.\n\nIt supports four different types of values:\n- byte strings\n- integers\n- lists\n- dictionaries\n\nBencoding is most commonly used in torrent files.\nThese metadata files are simply bencoded dictionaries.\n\n## Install with [npm](http://npmjs.org)\n\n```\nnpm install bencode\n```\n\n## Performance\n\n### encode\n```\n  11,883 op/s ⨠ bencode\n   5,457 op/s ⨠ bencoding\n   6,550 op/s ⨠ dht_bencode\n   5,405 op/s ⨠ bncode\n  10,978 op/s ⨠ dht\n```\n\n### decode\n```\n  30,240 op/s ⨠ bencode\n  25,293 op/s ⨠ bencoding\n  26,220 op/s ⨠ dht_bencode\n     824 op/s ⨠ bncode\n  19,824 op/s ⨠ dht\n```\n\n*Benchmarks run on an Intel Core2 CPU T9550 @ 2.66GHz with node v0.10.5*\n\nTo run the benchmarks simply use\n\n```\nnpm run-script bench\n```\n\n## Usage\n\n```javascript\nvar bencode = require( 'bencode' )\n```\n\nYou can also use node-bencode with browserify to be able to use it in a lot of modern browsers.\n\n[![testling results](https://ci.testling.com/themasch/node-bencode.png)](https://ci.testling.com/themasch/node-bencode)\n\n### Encoding\n\n```javascript\n\nvar data = {\n  string: 'Hello World',\n  integer: 12345,\n  dict: {\n    key: 'This is a string within a dictionary'\n  },\n  list: [ 1, 2, 3, 4, 'string', 5, {} ]\n}\n\nvar result = bencode.encode( data )\n\n```\n\n#### Output\n\n```\nd4:dictd3:key36:This is a string within a dictionarye7:integeri12345e4:listli1ei2ei3ei4e6:stringi5edee6:string11:Hello Worlde\n```\n\n### Decoding\n\n```javascript\nvar data   = new Buffer( 'd6:string11:Hello World7:integeri12345e4:dictd3:key36:This is a string within a dictionarye4:litli1ei2ei3ei4e6:stringi5edeee' )\nvar result = bencode.decode( data )\n```\n\n#### Output\n\n```javascript\n{\n  string: <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>,\n  integer: 12345,\n  dict: {\n    key: <Buffer 54 68 69 73 20 69 73 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 69 6e 20 61 20 64 69 63 74 69 6f 6e 61 72 79>\n  },\n  list: [ 1, 2, 3, 4, <Buffer 73 74 72 69 6e 67>, 5, {} ]\n}\n```\n\nAutomagically convert bytestrings to strings:\n\n```javascript\nvar result = bencode.decode( data, 'utf8' )\n```\n\n#### Output\n\n```javascript\n{\n  string: 'Hello World',\n  integer: 12345,\n  dict: {\n    key: 'This is a string within a dictionary'\n  },\n  list: [ 1, 2, 3, 4, 'string', 5, {} ]\n}\n```\n\n## API\n\n### bencode.encode( *data* )\n\n> `Buffer` | `Array` | `String` | `Object` | `Number` __data__\n\nReturns `Buffer`\n\n### bencode.decode( *data*, *encoding* )\n\n> `Buffer` __data__\n> `String` __encoding__\n\nIf `encoding` is set, bytestrings are\nautomatically converted to strings.\n\nReturns `Object` | `Array` | `Buffer` | `String` | `Number`\n",
  "readmeFilename": "README.md",
  "homepage": "https://github.com/themasch/node-bencode",
  "_id": "bencode@0.6.0",
  "_shasum": "04d6190e1d7467c56a969e1a94d1668076eac050",
  "_from": "bencode@^0.6.0",
  "_resolved": "https://registry.npmjs.org/bencode/-/bencode-0.6.0.tgz"
}
