Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string2compact

Package Overview
Dependencies
Maintainers
9
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

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3K
increased by9.21%
Maintainers
9
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 25 Jan 2023

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