ip-port-address
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

node-ip-port-address

Parse IP address and port from a string.

Installation

npm install ip-port-address

Usage

var parseAddress = require('ip-port-address');

parseAddress('127.0.0.1:8080');
// { ip: '127.0.0.1', port: 8080, family: 'ipv4' }

parseAddress('[::1]:8080');
// { ip: '::1', port: 8080, family: 'ipv6' }

parseAddress('localhost:8080');
// null

parseAddress('127.0.0.1:8080', 'ipv4');
// { ip: '127.0.0.1', port: 8080, family: 'ipv4' }

parseAddress('[::1]:8080', 'ipv4');
// null

Readme

Keywords

none

Package Sidebar

Install

npm i ip-port-address

Weekly Downloads

1

Version

0.1.0

License

none

Unpacked Size

22.5 kB

Total Files

11

Last publish

Collaborators

  • joyqi