my-ip-locator

1.1.3 • Public • Published

MY-IP-LOCATOR

Fetch the location of an ip address, city, region, country, and location while connection.

Uses ipinfo.io to query information.

Install

npm i --save my-ip-locator

Usage

import getMyIp from 'my-ip-locator';


async function fetchData() {
    try {
        const data = await getMyIp();
        console.log(data);
    } catch (error) {
        console.error('Error:', error);
    }
}

fetchData();

Outputs:

{
	ip: '123.456.789.111',
	city: 'XXX',
	region: 'XXX',
	country: 'XXX',
	loc: '1.2345,678.1111'
}

License

MIT - Copyright (c) Wildy Johanes Simanjuntak

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.3
    60
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.3
    60
  • 1.1.2
    0
  • 1.1.1
    1
  • 1.1.0
    1

Package Sidebar

Install

npm i my-ip-locator

Weekly Downloads

62

Version

1.1.3

License

MIT

Unpacked Size

1.71 kB

Total Files

3

Last publish

Collaborators

  • wildy