Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joyqi/node-ip-port-address
Parse IP address with port number into AddressInfo struct.
https://github.com/joyqi/node-ip-port-address
ipv4 ipv6
Last synced: 17 days ago
JSON representation
Parse IP address with port number into AddressInfo struct.
- Host: GitHub
- URL: https://github.com/joyqi/node-ip-port-address
- Owner: joyqi
- License: mit
- Created: 2022-11-29T05:02:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-29T06:44:45.000Z (almost 2 years ago)
- Last Synced: 2024-10-06T10:46:01.695Z (about 1 month ago)
- Topics: ipv4, ipv6
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/ip-port-address
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ip-port-address
Parse IP address and port from a string.
## Installation
```bash
npm install ip-port-address
```## Usage
```js
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');
// nullparseAddress('127.0.0.1:8080', 'ipv4');
// { ip: '127.0.0.1', port: 8080, family: 'ipv4' }parseAddress('[::1]:8080', 'ipv4');
// null
```