geoip-lite
Advanced tools
Comparing version 1.1.9 to 1.2.0
@@ -110,3 +110,4 @@ var fs = require('fs'); | ||
geodata.metro = locBuffer.readInt32BE((locId * locRecordSize) + 12); | ||
geodata.city = locBuffer.toString('utf8', (locId * locRecordSize) + 16, (locId * locRecordSize) + locRecordSize).replace(/\u0000.*/, ''); | ||
geodata.zip = locBuffer.readInt32BE((locId * locRecordSize) + 16); | ||
geodata.city = locBuffer.toString('utf8', (locId * locRecordSize) + 20, (locId * locRecordSize) + locRecordSize).replace(/\u0000.*/, ''); | ||
} | ||
@@ -113,0 +114,0 @@ |
{ | ||
"name" : "geoip-lite", | ||
"version" : "1.1.9", | ||
"version" : "1.2.0", | ||
"description" : "A light weight native JavaScript implementation of GeoIP API from MaxMind", | ||
@@ -11,3 +11,3 @@ "keywords" : ["geo", "geoip", "ip", "ipv4", "ipv6", "geolookup", "maxmind", "geolite"], | ||
"repository" : { "type": "git", "url": "git://github.com/bluesmoon/node-geoip.git" }, | ||
"engines" : { "node": ">=0.6.3" }, | ||
"engines" : { "node": ">=5.10.0" }, | ||
"scripts": { | ||
@@ -14,0 +14,0 @@ "test": "nodeunit --reporter=minimal test/tests.js", |
@@ -19,3 +19,3 @@ GeoIP-lite | ||
Both IPv4 and IPv6 addresses are supported, however since the GeoLite IPv6 database does not currently contain any city or region | ||
information, city and region lookups are only supported for IPv4. | ||
information, city, region and postal code lookups are only supported for IPv4. | ||
@@ -49,7 +49,9 @@ philosophy | ||
console.log(geo); | ||
{ range: [ 3479299040, 3479299071 ], | ||
{ range: [ 3479297920, 3479301339 ], | ||
country: 'US', | ||
region: 'CA', | ||
city: 'San Francisco', | ||
ll: [37.7484, -122.4156] } | ||
region: 'TX', | ||
city: 'San Antonio', | ||
ll: [ 29.4889, -98.3987 ], | ||
metro: 641, | ||
zip: 78218 } | ||
``` | ||
@@ -100,3 +102,5 @@ | ||
city: "City Name", // This is the full city name | ||
ll: [<latitude>, <longitude>] // The latitude and longitude of the city | ||
ll: [<latitude>, <longitude>], // The latitude and longitude of the city | ||
metro: <metro code>, // Metro code | ||
zip: <postal code> // Postal code (IPv4 only) | ||
} | ||
@@ -103,0 +107,0 @@ ``` |
@@ -372,2 +372,3 @@ // fetches and converts maxmind lite databases | ||
var city = fields[3]; | ||
var zip = parseInt(fields[4]); | ||
var lat = Math.round(parseFloat(fields[5]) * 10000); | ||
@@ -388,4 +389,8 @@ var lon = Math.round(parseFloat(fields[6]) * 10000); | ||
b.write(city, 16); | ||
if(zip){ | ||
b.writeInt32BE(zip, 16); | ||
} | ||
b.write(city, 20); | ||
fs.writeSync(datFile, b, 0, b.length, null); | ||
@@ -392,0 +397,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83810971
1044
182