Skip to content

Migration guide

Mathieu M-Gosselin edited this page Sep 6, 2016 · 3 revisions

Migration guide

Version v0.6 to v1

Changes overview:

  • Reader instance per database (stateful reader)
  • Unstructured output format. It means that library doesn't do any mapping but rather returns exact results from binary mmdb database.

Free databases: http://dev.maxmind.com/geoip/geoip2/geolite2/

Code samples:

// maxmind@0.6
var maxmind = require('maxmind');
maxmind.init('/path/to/GeoLiteCity.dat');
maxmind.init('/path/to/GeoIPASNum.dat');
maxmind.init('/path/to/GeoISP.dat');

var org = maxmind.getIsp('66.6.44.4');
var org = maxmind.getAsn('66.6.44.4');
var location = maxmind.getLocation('66.6.44.4');
// maxmind@1
var maxmind = require('maxmind');

var cityLookup = maxmind.open('/path/to/GeoLiteCity.mmdb');
var asnLookup = maxmind.open('/path/to/GeoIPASNum.mmdb');
var ispLookup = maxmind.open('/path/to/GeoISP.mmdb');

var org = ispLookup.get('66.6.44.4');
var org = asnLookup.get('66.6.44.4');
var location = cityLookup.get('66.6.44.4');
Clone this wiki locally