npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

geolite2

v3.6.2

Published

Maxmind's GeoLite2 Free Databases

Downloads

11,045

Readme

node-geolite2

Maxmind's GeoLite2 Free Databases download helper.

Configuration

Access Key

IMPORTANT You must set up MAXMIND_ACCOUNT_ID and MAXMIND_LICENSE_KEY environment variables to be able to download databases. To do so, go to the https://www.maxmind.com/en/geolite2/signup, create a free account and generate new license key.

If you don't have access to the environment variables during installation, you can provide config via package.json:

{
  ...
  "geolite2": {
    // specify the account id
    "account-id": "<your account id>",
    // specify the key
    "license-key": "<your license key>",
    // ... or specify the file where key is located:
    "license-file": "maxmind-license.key"
  }
  ...
}

Beware of security risks of adding keys and secrets to your repository!

Note: For backwards compatibility, the account ID is currently optional. When not provided we fall back to using legacy Maxmind download URLs with only the license key. However, this behavior may become unsupported in the future so adding an account ID is recommended.

Selecting databases to download

You can select the dbs you want downloaded by adding a selected-dbs property on geolite2 via package.json.

selected-dbs must be an array of strings, one or more of the values City, Country, ASN.

If selected-dbs is unset, or is set but empty, all dbs will be downloaded.

{
  ...
  "geolite2": {
    "selected-dbs": ["City", "Country", "ASN"]
  }
  ...
}

Usage

var geolite2 = require('geolite2');
var maxmind = require('maxmind');

var lookup = maxmind.openSync(geolite2.paths.city); // or geolite2.paths.country or geolite2.paths.asn
var city = lookup.get('66.6.44.4');

Alternatives

geolite2-redist provides redistribution which does not require personal license key. Make sure you understand legal terms and what they mean for your use-case.

License

Creative Commons Attribution-ShareAlike 4.0 International License