1.1.3 • Published 8 months ago
my-ip-locator v1.1.3
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