Convert 'hostname:port' strings to BitTorrent's compact ip/host binary returned by Trackers
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.travis.yml
.zuul.yml zuul: remove flaky ios tests; test latest; add edge Mar 7, 2016
LICENSE license Aug 10, 2014
README.md standard Mar 21, 2017
index.js support string2compact.multi6() usage Nov 26, 2014
package.json

README.md

string2compact travis npm downloads javascript style guide

Convert 'hostname:port' strings to BitTorrent's compact ip/host binary returned by Trackers

Sauce Test Status

This module is the opposite of compact2string. It works in the browser with browserify. It is used by WebTorrent, and more specifically, the bittorrent-tracker and bittorrent-dht modules.

install

npm install string2compact

usage

single string2compact

var string2compact = require('string2compact')
var compact = string2compact('10.10.10.5:65408')
console.log(compact) // new Buffer('0A0A0A05FF80', 'hex')

tranform multiple into one buffer

var compacts = string2compact([ '10.10.10.5:128', '100.56.58.99:28525' ])
console.log(compacts) // new Buffer('0A0A0A05008064383a636f6d', 'hex')

license

MIT. Copyright (c) Feross Aboukhadijeh.