@kcak11/myip

5.0.1 • Public • Published

MyIP - A Utility to fetch IP Addresses

Installation:

$ npm i -g @kcak11/myip

Usage as Command Line Interface (CLI):

$ myip

The above will output the current IP addresses associated with your machine as below:

                                                          
 Following are the IP Addresses for your machine:         
                                                          
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 |       IP Address     | Usage in a web-browser        | 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 |      xyz.pqr.a.b     | http://xyz.pqr.a.b            | 
 |   xyz.pq.abc.def     | http://xyz.pq.abc.def         | 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
                                                          
 External(public) IP: XXX.YY.ZZ.AAA                  
                                                          

Usage in Node Scripts

const myip=require("@kcak11/myip");
let listOfIP = myip(); // listOfIP will be an array containing the IP addresses.
console.log(listOfIP);

let externalIP = require("@kcak11/myip/external");
externalIP().then((data) => {
  console.log("External IP: " + data.myip);
  console.log("Country: " + data.country);
});

Output:

["xyz.pqr.a.b","xyz.pq.abc.def"]
External IP: XXX.YY.ZZ.AAA
Country: CC

License: MIT License

© 2023 kcak11.com

Package Sidebar

Install

npm i @kcak11/myip

Weekly Downloads

2

Version

5.0.1

License

MIT

Unpacked Size

7.88 kB

Total Files

10

Last publish

Collaborators

  • kcak11.npm