Documentation Index
Fetch the complete documentation index at: https://mintlify.com/msimerson/maxmind-geolite-mirror/llms.txt
Use this file to discover all available pages before exploring further.
maxmind-geolite-mirror is a zero-argument CLI tool that checks each GeoLite2 database against the MaxMind download server and fetches only what has changed. On every run it issues an HTTP HEAD request with an If-Modified-Since header derived from the local file’s modification time. If the server returns 304 Not Modified, the file is left untouched; if it returns 200 OK, the tool downloads the .tar.gz archive, extracts the .mmdb file, and writes it to the configured database directory.
Basic invocation
WithMAXMIND_LICENSE_KEY already exported in your shell session, run the tool with no arguments:
maxmind-geolite-mirror accepts no CLI flags or positional arguments. All
configuration is supplied through environment variables or by editing
lib/config.js directly. Passing any arguments on the command line has no
effect.Example output
Fresh download (file does not yet exist, or remote is newer):304 for every database):
npm test.
Database processing order
The tool iterates through the three databases in series, in this fixed order:GeoLite2-Country.mmdbGeoLite2-City.mmdbGeoLite2-ASN.mmdb
404 responses
If the MaxMind server returns404 Not Found for a database — for example because the edition ID has changed or the license key does not grant access to that edition — the tool logs the following message and continues to the next database. A 404 is not treated as a fatal error and does not trigger a non-zero exit:
Redirect handling
The tool transparently follows302 redirects during the download phase. If the MaxMind download server redirects the GET request, the tool re-issues the request to the Location URL automatically. No user action or configuration is required.
Error handling and exit codes
When an error occurs during processing of any database — such as a missing license key, a network failure, or a failed write — the tool prints the error to stderr, logsexiting prematurely. to stdout if any databases remain in the queue, and exits with code 1. Databases that have not yet been processed are skipped.
Custom database directory
UseMAXMIND_DB_DIR to write databases to a path other than the default /usr/local/share/GeoIP/. The variable can be set inline for a one-off run:
Tarball extraction
Downloads arrive as.tar.gz archives. The tool extracts the .mmdb file from the archive using the optional tar-stream package, then writes it atomically to the destination via a .tmp intermediate file.
tar-stream is listed as an optional dependency. If it is not installed, the
tool emits the error cannot open ..., tar-stream package is not available.
and exits with code 1. Install it with: