You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-ipv4

The easiest way to show an IPv4 address

0.1.1
latest
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created

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/`);
});

Keywords

FAQs

Package last updated on 13 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts