diff options
-rw-r--r-- | README.md | 44 |
1 files changed, 40 insertions, 4 deletions
@@ -1,17 +1,53 @@ | |||
1 | # Synopsis | 1 | # Synopsis |
2 | 2 | ||
3 | Just a [faster][1] BEncode package. | 3 | BEncode is JSON-like format used in bittorrent protocol but might be |
4 | used anywhere else. | ||
4 | 5 | ||
5 | # Description | 6 | # Description |
6 | 7 | ||
7 | Bencode (pronounced like B encode) is the encoding used by the peer-to-peer | 8 | This package implements fast seamless encoding/decoding to/from |
8 | file sharing system BitTorrent for storing and transmitting loosely structured data. | 9 | bencode format for many native datatypes. To achive |
9 | See full documentation at ```src/Data/BEncode.hs```. | 10 | [more performance][1] we use new bytestring builders and hand |
11 | optimized attoparsec parser so this library is considered as | ||
12 | replacement for BEncode and AttoBencode packages. | ||
13 | |||
14 | ## Format | ||
15 | |||
16 | Bencode is pretty similar to JSON: it has dictionaries(JSON objects), | ||
17 | lists(JSON arrays), strings and integers. However bencode has a few | ||
18 | advantages: | ||
19 | |||
20 | * No spaces in between any values — nor lists nor dicts nor anywhere else. | ||
21 | * Dictionaries always sorted lexicographically by the keys. This allow | ||
22 | us to test data on equality without decoding from raw bytestring. | ||
23 | Moreover this allow to hash encoded data (this property is heavily | ||
24 | used by core bittorrent protocol). | ||
25 | * All strings prefixed with its length. This simplifies and speed up | ||
26 | string parsing. | ||
27 | |||
28 | |||
29 | As always, each advantage has its disadvantage: | ||
30 | |||
31 | * Bencode is certainly less human readable than JSON. | ||
32 | * Bencode is rarely used. Except bittorrent protocol of course. But | ||
33 | this might be not a problem if you are searching for format for | ||
34 | internal use only. | ||
35 | |||
36 | |||
37 | # Documentation | ||
38 | |||
39 | For documentation see haddock generated documentation. | ||
10 | 40 | ||
11 | # Build Status | 41 | # Build Status |
12 | 42 | ||
13 | [![Build Status][2]][3] | 43 | [![Build Status][2]][3] |
14 | 44 | ||
45 | # Authors | ||
46 | |||
47 | This library is written and maintained by Sam T. <pxqr.sta@gmail.com> | ||
48 | Feel free to report bugs and suggestions via github issue tracker or the mail. | ||
49 | |||
50 | |||
15 | [1]: http://htmlpreview.github.com/?https://github.com/pxqr/bencoding/master/bench/comparison.html | 51 | [1]: http://htmlpreview.github.com/?https://github.com/pxqr/bencoding/master/bench/comparison.html |
16 | [2]: https://travis-ci.org/pxqr/bencoding.png | 52 | [2]: https://travis-ci.org/pxqr/bencoding.png |
17 | [3]: https://travis-ci.org/pxqr/bencoding | 53 | [3]: https://travis-ci.org/pxqr/bencoding |