https://github.com/nodef/extra-net
Support methods for Net module.
https://github.com/nodef/extra-net
address extra free ip method module net public support utility
Last synced: 5 months ago
JSON representation
Support methods for Net module.
- Host: GitHub
- URL: https://github.com/nodef/extra-net
- Owner: nodef
- License: bsd-3-clause
- Created: 2019-04-05T08:22:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T17:12:43.000Z (11 months ago)
- Last Synced: 2025-09-12T05:16:01.339Z (5 months ago)
- Topics: address, extra, free, ip, method, module, net, public, support, utility
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/extra-net
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Support methods for [Net module].
> - Need machine's public IP address?
> - Need a free port for container?
```javascript
const net = require('extra-net');
var {family, address} = net.address();
// family: 'IPv4', address: '192.168.1.7'
var port = await net.freePort();
// port: 37567
```
## reference
```javascript
const net = require('extra-net');
// : includes all functions of "net"
net.address([options]);
options = {
internal: Boolean, // true | false (default)
address: String, // 'IPv4' | 'IPv6'
netmask: String, // e.g., '255.255.255.0'
}
-> {address, netmask, family, mac, internal, cidr}
net.freePort([host]);
host = String // e.g., '127.0.0.1'
-> Promise port
```

[Net module]: https://nodejs.org/api/net.html