Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Node.js Geo IP API framework.
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore Add README.md
LICENSE Added framework
README.md Adjust name.
cruft.js Added framework
examples.js Added license file.
index.js Add README.md
package.json

README.md

JavaScript Geo IP API framework

Node.js Geographic IP lookup framework.

Services Implements:

Installation

Install with the Node.JS package manager npm:

  $ npm install ipwhere

Documentation

This package implements the free open geo IP. No data file required. The accuracy of the lite version is not perfect, but provides decent country, state and city. To use this service, register on their site and store the api key in an enviroment variable.

Example

var ipwhere = require("ipwhere");

var ip = new ipwhere({
    // required
    apikey: process.env.IFAPIDB_KEY, // "XXXXXXXXXXXXXX"
    // optional
    timeout: 5000
});

ip.city('213.243.4.20', function(err, data) {
   console.log('JSON Result (IPv4)', data);
});

// Options: { format: 'json|xml|raw (defaults to JSON)' }

ip.country('213.243.4.20', { format: 'raw' }, function(err, data) {
  console.log('Raw Result (IPv4)', data);
});

// Sample Result

{ statusCode: 'OK',
  statusMessage: '',
  ipAddress: '213.243.4.20',
  countryCode: 'TR',
  countryName: 'TURKEY',
  regionName: 'ISTANBUL',
  cityName: 'ISTANBUL',
  zipCode: '-',
  latitude: '41.0138',
  longitude: '28.9497',
  timeZone: '+02:00' 
}

LICENSE

MIT license. See the LICENSE file for details.

Something went wrong with that request. Please try again.