1.1.5 • Published 4 years ago

ip-utility v1.1.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

IP UTILITY

npm version

Installation

You can install with npm:

$ npm install ip-utility --save

You can also install through yarn:

$ yarn add ip-utility

Features

It`s written in Typescript then you can access to the relative data types. This package exposes 2 functions

  • getPublic
  • getPrivate

getPublic

This is an async function that return you a string with your public ip

Without async

const { getPublic } = require(`ip-utility`);

getPublic()
.then( ip => {
    console.log("Public IP:", ip);
})

With async

( async function () {
const { getPublic } = require(`ip-utility`);

const ip = await getPublic();
console.log("Public IP:", ip);
})()

getPrivate( options )

  • options
    • wifi
      • not required
      • boolean
      • return an array of object or an single object that describes all Wi-Fi interfaces
    • ethernet
      • not required
      • boolean
      • return an array of object or an single object that describes all Ethernet interfaces
const { getPrivate } = require(`ip-utility`);

// Only 1 wifi interface
const ip = getPrivate({
    wifi: true
});

console.log("my WI-FI local IP:", ip.wifi.ip.v4);
console.log("my WI-FI mac", ip.wifi.mac);
1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago