{
  "name": "bencode",
  "version": "0.4.3",
  "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": {
    "benchmark": "",
    "bencoding": "",
    "dht-bencode": "",
    "bncode": "",
    "dht.js": "",
    "mocha": ""
  },
  "scripts": {
    "test": "./node_modules/.bin/mocha"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/themasch/node-bencode.git"
  },
  "bugs": {
    "url": "https://github.com/themasch/node-bencode/issues"
  },
  "readme": "\n# node-bencode [![build status](https://secure.travis-ci.org/themasch/node-bencode.png)](http://travis-ci.org/themasch/node-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```\nbencode x 7,939 ops/sec ±2.22% (74 runs sampled)\nbencoding x 5,632 ops/sec ±1.47% (86 runs sampled)\ndht-bencode x 6,403 ops/sec ±3.45% (87 runs sampled)\nbncode x 5,106 ops/sec ±3.63% (82 runs sampled)\ndht.js x 7,972 ops/sec ±2.22% (84 runs sampled)\n```\n\n### decode\n```\nbencode x 29,588 ops/sec ±0.75% (99 runs sampled)\nbencoding x 27,844 ops/sec ±1.97% (95 runs sampled)\ndht-bencode x 22,975 ops/sec ±1.84% (90 runs sampled)\nbncode x 990 ops/sec ±2.71% (88 runs sampled)\ndht.js x 19,103 ops/sec ±2.14% (89 runs sampled)\n```\n\n*all benchmarks from an Intel Core2Duo@2.6GHz with node v0.10.3.*\n\n## Usage\n\n```javascript\nvar bencode = require( 'bencode' )\n```\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",
  "_id": "bencode@0.4.3",
  "dist": {
    "shasum": "b08978febcaca65b4b190e72332cf935f7725c0d"
  },
  "_from": "bencode@",
  "_resolved": "https://registry.npmjs.org/bencode/-/bencode-0.4.3.tgz"
}
