any-ipv4

0.1.1 • Public • Published

any-ipv4

A module that exports an Array of IPv4, non internal, addresses, wuth a handy toString() method that returns its first IP, or 0.0.0.0 if no IPv4 was found.

The list of IPs is Wi-Fi first, Ethernet after, which is the most common use case I have for IoT projects and so on.

import IPv4 from 'any-ipv4';
import {createServer} from 'http';

createServer(handler).listen(8080, () => {
  console.log(`http://${IPv4}:8080/`);
});

Readme

Keywords

Package Sidebar

Install

npm i any-ipv4

Weekly Downloads

36

Version

0.1.1

License

ISC

Unpacked Size

3.37 kB

Total Files

6

Last publish

Collaborators

  • webreflection