1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
Oinktube/node_modules/string2compact
2023-02-17 15:04:26 -03:00
..
CHANGELOG.md Updates node modules 2023-02-17 15:04:26 -03:00
index.js Updates node modules 2023-02-17 15:04:26 -03:00
LICENSE Updates node modules 2023-02-17 15:04:26 -03:00
package.json Updates node modules 2023-02-17 15:04:26 -03:00
README.md Updates node modules 2023-02-17 15:04:26 -03:00

string2compact ci npm downloads javascript style guide

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

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 and WebTorrent, LLC.