Skip to content

Convert Buffer/String/Object IP:Port Representations

Notifications You must be signed in to change notification settings

bencevans/node-ipport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ipport

convert ip:port object/string/buffer

Build Status Coverage Status Dependency Status

GitHub NPM Author

accepted structures

object: {address:'address', port:port}:

  • {address:'127.0.0.1', port:3000}
  • {address:'8.8.8.8', port:53}

string: address:port:

  • 127.0.0.1:3000
  • 8.8.8.8:53

buffer: new Buffer([net[0], net[1], net[2], net[3], port(Int16BE)]):

  • <Buffer 7f 00 00 01 0b b8>
  • <Buffer 08 08 08 08 00 35>

methods

  • toObject(IPPort) - returns given IPPort as an object
  • toString(IPPort) - returns given IPPort as an string
  • toBuffer(IPPort) - returns given IPPort as an buffer

install

npm install ipport

licence

MIT

About

Convert Buffer/String/Object IP:Port Representations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published