Socket
Socket
Sign inDemoInstall

string2compact

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string2compact

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


Version published
Weekly downloads
3.6K
decreased by-5.36%
Maintainers
1
Weekly downloads
 
Created
Source

string2compact travis 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.

Keywords

FAQs

Package last updated on 27 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc