Node.js Geo IP API framework.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
cruft.js
examples.js
index.js
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.