Created
May 15, 2011 06:12
-
-
Save shripadk/972909 to your computer and use it in GitHub Desktop.
GeoIP 0.3.4-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var geoip = require('[email protected]'); | |
var ip = '50.19.121.109'; | |
var data = geoip.open('/usr/local/share/GeoIP/GeoLiteCity.dat'); | |
var result = geoip.City.record_by_addr(data, ip); | |
console.log(result); | |
/** | |
RESULT: | |
{ country_code: 'US', | |
country_code3: 'USA', | |
country_name: 'United States', | |
continent_code: 'NA', | |
region: 'WA', | |
city: 'Seattle', | |
postal_code: '98144', | |
latitude: 47.5839, | |
longitude: -122.2995, | |
metro_code: 819, | |
dma_code: 819, | |
area_code: 206 } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment