maxmind-asn
raw JSON → 1.0.3-20191224 verified Sat May 09 auth: no javascript
Provides pre-packaged MaxMind GeoLite2 ASN database for use with node-maxmind. This package distributes the ASN database (autonomous system number and organization) for IP geolocation lookups, released weekly. Version 1.0.3-20191224 is the latest. It simplifies integrating MaxMind's free GeoLite2 databases into Node.js applications by avoiding manual downloads. Compared to alternatives like geoip-lite, it offers more accurate and up-to-date data via MaxMind's official databases. Note the licensing changes effective December 30, 2019, requiring a free MaxMind account for database access.
Common errors
error Error: Cannot find module 'maxmind-asn' ↓
cause Missing import of the package; user may have forgotten to install it or used wrong import syntax.
fix
Run 'npm install maxmind-asn' and ensure you import using require('maxmind-asn') (CommonJS) or import 'maxmind-asn' (ESM).
error TypeError: maxmind.openSync is not a function ↓
cause Using a version of node-maxmind that does not export openSync (e.g., very old version).
fix
Install the latest node-maxmind version: 'npm install maxmind@latest'
error Error: ENOTDIR: not a directory, open '/path/to/node_modules/maxmind-asn/index.mmdb' ↓
cause The packaged file structure may be incorrect or the package was corrupted.
fix
Reinstall the package: 'npm install maxmind-asn'
Warnings
breaking License changes effective December 30, 2019 require a free MaxMind account and API key to download GeoLite2 databases, but as of v1.0.3-20191224, the npm package still bundles the database. Future updates may require manual download or API key. ↓
fix Check MaxMind blog for updates; consider using 'maxmind' package with manual database download and API key.
deprecated The maxmind-databases packages (maxmind-asn, maxmind-country, maxmind-city) may be deprecated in favor of a more integrated approach with node-maxmind's built-in database download. ↓
fix Use node-maxmind's new database download features instead of separate npm packages.
gotcha The database is bundled and installed in node_modules; it may become stale. For up-to-date data, users should consider downloading the latest database manually. ↓
fix Periodically update the package to get the latest database, or use MaxMind's direct download.
gotcha The package size is ~5 MB uncompressed; it may not be suitable for environments with strict size limits. ↓
fix Evaluate if bundling a full database is acceptable for your use case.
Install
npm install maxmind-asn yarn add maxmind-asn pnpm add maxmind-asn Imports
- maxmind-asn wrong
import asn from 'maxmind-asn';correctimport maxmind from 'maxmind'; const asn = maxmind.openSync(require('maxmind-asn')); - maxmind wrong
const maxmind = require('maxmind');correctimport maxmind from 'maxmind'; - lookupASN.get() wrong
const result = require('maxmind-asn').get('8.8.8.8');correctconst lookup = maxmind.openSync(require('maxmind-asn')); const result = lookup.get('8.8.8.8');
Quickstart
import maxmind from 'maxmind';
import asnDb from 'maxmind-asn';
const lookup = maxmind.openSync(asnDb);
const result = lookup.get('8.8.8.8');
console.log(result);
// {
// autonomous_system_number: 15169,
// autonomous_system_organization: 'Google LLC'
// }