1 | # compact2string
|
2 |
|
3 | Convert 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
|
14 | var compact2string = require("compact2string");
|
15 | var Buffer = require("buffer").Buffer;
|
16 | var ipport = compact2string(new Buffer("0A0A0A05FF80", "hex"));
|
17 | console.log(ipport);
|
18 | ```
|
19 |
|
20 | => ```"10.10.10.5:65408" ```
|
21 |
|
22 | ### Multiple in same buffer
|
23 |
|
24 | ```javascript
|
25 | var hostports = compact2string.multi(new Buffer("0A0A0A05008064383a636f6d", "hex"));
|
26 | console.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 |