Skip to content

Instantly share code, notes, and snippets.

@shripadk
Created May 15, 2011 06:14
Show Gist options
  • Save shripadk/972913 to your computer and use it in GitHub Desktop.
Save shripadk/972913 to your computer and use it in GitHub Desktop.
GeoIP 0.4.0beta1
var geoip = require('geoip@0.4.0beta1');
var ip = '50.19.121.109';
var city = new geoip.City('/usr/local/share/GeoIP/GeoLiteCity.dat');
city.lookup(ip, function(data) {
console.log(data);
});
/**
RESULT:
{ country_code: 'US',
country_code3: 'USA',
country_name: 'United States',
region: 'WA',
postal_code: '98144',
latitude: 47.583900451660156,
metro_code: 819,
dma_code: 819,
area_code: 206,
continent_code: 'NA' }
Missing longitude, city(!!)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment