Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geoip-lite

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geoip-lite

A light weight native JavaScript implementation of GeoIP API from MaxMind

  • 1.0.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
134K
decreased by-14.98%
Maintainers
1
Weekly downloads
 
Created

What is geoip-lite?

The geoip-lite npm package provides a fast and lightweight IP geolocation library for Node.js. It allows you to look up the geographic location of an IP address, including country, region, and city information. The package uses a local database, which means it does not require an external service or API call, making it suitable for high-performance applications.

What are geoip-lite's main functionalities?

IP to Country Lookup

This feature allows you to look up the country associated with a given IP address. The code sample demonstrates how to use the `lookup` method to retrieve the country code for the IP address '207.97.227.239'.

const geoip = require('geoip-lite');
const ip = '207.97.227.239';
const geo = geoip.lookup(ip);
console.log(geo.country); // Output: 'US'

IP to City Lookup

This feature allows you to look up the city associated with a given IP address. The code sample demonstrates how to use the `lookup` method to retrieve the city name for the IP address '207.97.227.239'.

const geoip = require('geoip-lite');
const ip = '207.97.227.239';
const geo = geoip.lookup(ip);
console.log(geo.city); // Output: 'San Antonio'

IP to Region Lookup

This feature allows you to look up the region (state or province) associated with a given IP address. The code sample demonstrates how to use the `lookup` method to retrieve the region code for the IP address '207.97.227.239'.

const geoip = require('geoip-lite');
const ip = '207.97.227.239';
const geo = geoip.lookup(ip);
console.log(geo.region); // Output: 'TX'

IP to Latitude and Longitude Lookup

This feature allows you to look up the latitude and longitude coordinates associated with a given IP address. The code sample demonstrates how to use the `lookup` method to retrieve the coordinates for the IP address '207.97.227.239'.

const geoip = require('geoip-lite');
const ip = '207.97.227.239';
const geo = geoip.lookup(ip);
console.log(geo.ll); // Output: [29.4889, -98.3987]

Other packages similar to geoip-lite

Keywords

FAQs

Package last updated on 04 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc