get-ip-location-lite
v1.0.1
Published
Fetches IP address geolocation data using ip-api.com (no API key required)
Maintainers
Readme
🌍 get-ip-location-lite
Lightweight utility to fetch geolocation data (country, city, ISP, coordinates, etc.) from an IP address using the ipwho.is API.
No API key required. Works with HTTPS.
📦 Installation
Using npm
npm install get-ip-location-liteUsing yarn
yarn add get-ip-location-lite🚀 Usage
const getIPLocation = require("get-ip-location-lite");
// Get the location of the current user's IP
getIPLocation()
.then(data => console.log("Your IP Location:", data))
.catch(err => console.error("Error:", err));
// OR get location info for a specific IP
getIPLocation("8.8.8.8")
.then(data => console.log("Google DNS IP Location:", data))
.catch(err => console.error("Error:", err));⚙️ Options
No options object required.
| Parameter | Type | Required | Description |
|-----------|----------|----------|----------------------------------------|
| ip | string | ❌ | IP address to lookup (leave blank for current IP) |
📤 Output Example
{
"ip": "8.8.8.8",
"success": true,
"country": "United States",
"city": "Mountain View",
"region": "California",
"latitude": 37.386,
"longitude": -122.0838,
"isp": "Google LLC"
}Powered by ipwho.is
🧪 Run Test
node test.js🪪 License
MIT