UNPKG

734 BMarkdownView Raw
1# compact2string
2
3Convert bittorrent's [compact](http://wiki.theory.org/BitTorrent_Tracker_Protocol#Peer_Dictionary_Format) ip/host binary returned by Trackers to 'hostname:port' string.
4
5## Installation
6
7```npm install compact2string```
8
9## Usage
10
11### Single compact2string
12
13```javascript
14var compact2string = require("compact2string");
15var Buffer = require("buffer").Buffer;
16var ipport = compact2string(new Buffer("0A0A0A05FF80", "hex"));
17console.log(ipport);
18```
19
20=> ```"10.10.10.5:65408" ```
21
22### Multiple in same buffer
23
24```javascript
25var hostports = compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex"));
26console.log(hostports);
27```
28
29=> ```[ '10.10.10.5:128', '100.56.58.99:28525' ]```
30
31## Licence
32
33(MIT Licence)
\No newline at end of file