{"id":14258491,"url":"https://github.com/GitSquared/node-geolite2-redist","last_synced_at":"2025-08-13T01:31:45.312Z","repository":{"id":40944820,"uuid":"235288467","full_name":"GitSquared/node-geolite2-redist","owner":"GitSquared","description":"Redistribution of MaxMind GeoLite2 GeoIP databases as an npm library","archived":false,"fork":false,"pushed_at":"2024-12-12T00:32:09.000Z","size":36400,"stargazers_count":88,"open_issues_count":1,"forks_count":18,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-12-13T08:40:09.869Z","etag":null,"topics":["geoip","maxmind","nodejs","npm-package"],"latest_commit_sha":null,"homepage":"https://gitsquared.github.io/node-geolite2-redist/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GitSquared.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-21T08:17:46.000Z","updated_at":"2024-12-12T00:32:14.000Z","dependencies_parsed_at":"2024-01-06T01:30:02.679Z","dependency_job_id":"0ea8de4b-489a-451c-ad53-545b68944ae8","html_url":"https://github.com/GitSquared/node-geolite2-redist","commit_stats":{"total_commits":1035,"total_committers":13,"mean_commits":79.61538461538461,"dds":0.2202898550724638,"last_synced_commit":"a5a348c2887bf15bed1f2483149122ae81f1cf12"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitSquared%2Fnode-geolite2-redist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitSquared%2Fnode-geolite2-redist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitSquared%2Fnode-geolite2-redist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GitSquared%2Fnode-geolite2-redist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GitSquared","download_url":"https://codeload.github.com/GitSquared/node-geolite2-redist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229721628,"owners_count":18114043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geoip","maxmind","nodejs","npm-package"],"created_at":"2024-08-22T09:00:58.685Z","updated_at":"2024-12-14T15:30:39.855Z","avatar_url":"https://github.com/GitSquared.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# node-geolite2-redist\n\n[![Automatic Redistribution Updates](https://github.com/GitSquared/node-geolite2-redist/workflows/Databases%20Updater/badge.svg?branch=master\u0026event=schedule)](https://github.com/GitSquared/node-geolite2-redist/actions?query=workflow%3A%22Databases+Updater%22) [![NPM published version](https://badgen.net/npm/v/geolite2-redist)](https://www.npmjs.com/package/geolite2-redist) [![Node version](https://badgen.net/npm/node/geolite2-redist)](https://nodejs.org/en/about/releases/) [![Types Status](https://badgen.net/npm/types/geolite2-redist)](#typescript)\n\n---\n\nMaxMind's GeoLite2 free databases as an npm library. **As this is a redistribution, you don't need a MaxMind license key.** However, some additional legal restrictions apply, make sure to read this README and the [Legal Warning](#legal-warning) carefully before deciding to use this.\n\nYou will need a database reader capable of reading `.mmdb` files, like [node-maxmind](https://www.npmjs.com/package/maxmind), if you wish to use the data.\n\nThis package is compatible with the 3 GeoLite2 databases, namely:\n - `GeoLite2-ASN`\n - `GeoLite2-Country`\n - `GeoLite2-City`\n\nFor more info check out the [MaxMind website](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data).\n\nDue to license requirements, **this package automatically updates the databases in the background** when it detects that a new version is available. This should be transparent for most usecases, if you're experiencing any problem with it, please file an issue.\n\nSee [Legal Warning](#legal-warning) section for more info on licensing and limitations.\n\n## Usage\n\n### Installing\n\n`npm install geolite2-redist`\n\n### Using the geoip data\n\nExample geoip lookup in a Node environment, using the `GeoLite2-City` database with `node-maxmind` as a db reader:\n\n#### Javascript\n\n```javascript\nconst maxmind = require('maxmind');\n\n// This module is distributed as en ESM module (import...from... syntax), but you can\n// use an import() promise to make it work without switching to ESM!\nimport('geolite2-redist').then((geolite2) =\u003e {\n return geolite2.open(\n  'GeoLite2-City',                 // database name\n  (dbPath) =\u003e maxmind.open(dbPath) // function that builds a useful db reader\n  )\n}).then((reader) =\u003e {\n  const lookup = reader.get('185.194.81.29')\n\n  console.log(lookup.country.iso_code) // FR 🥖🇫🇷\n\n  // Calling close() here shuts everything down nicely and clears up Node's event loop.\n  reader.close()\n})\n```\n\n#### Typescript\n\n```typescript\nimport geolite2, { GeoIpDbName } from 'geolite2-redist';\nimport maxmind, { CountryResponse } from 'maxmind';\n\n(async () =\u003e {\n  const reader = await geolite2.open(\n    GeoIpDbName.Country, // Use the enum instead of a string!\n    (path) =\u003e maxmind.open\u003cCountryResponse\u003e(path)\n  )\n\n  const lookup = reader.get('185.194.81.29')\n\n  console.log(lookup.country.iso_code) // FR 🥖🇫🇷\n\n  reader.close()\n})();\n```\n\n### Preloading databases\n\nYou can add this to your `package.json` to preload the databases after running `npm install`, instead of downloading them the first time `open` is called:\n\n```json\n{\n  \"scripts\": {\n    \"preload\": \"node -e \\\"import('geolite2-redist').then(geolite =\u003e geolite.downloadDbs())\\\"\"\n  }\n}\n```\n\n## API\n\nYou can find a more detailed documentation [on the Typedoc-generated website](https://gitsquared.github.io/node-geolite2-redist/modules.html).\n\n## Legal Warning\n\nPrivacy regulations (CCPA in California, GDPR in Europe) that implement the right-to-forget have affected MaxMind's EULA \u0026 licenses.\nIn a nutshell, you should always make sure your GeoIP databases are up to date, which this library conveniently does for you ;)\n\nThat said, please carefully read the LICENSE and EULA files. The databases are provided under certain restrictions and obligations, most notably:\n - You cannot prevent the library from updating the databases.\n - You cannot use the GeoLite2 data:\n   - for [FCRA](https://www.ftc.gov/enforcement/statutes/fair-credit-reporting-act) purposes in the USA,\n   - to identify specific households or individuals, worldwide.\n\nIf you plan on using `node-geolite2` behind a firewall, you need to whitelist the [GitHub IP range](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses) so that the package can reach the databases mirror.\n\n## Compatibility\n\nWe follow the OpenJS Foundation's [deprecation schedule](https://nodejs.org/en/about/releases/) and support all maintained Node versions.\n\n## Alternatives\n\nIf you do have a MaxMind license key (which you can get by signing up [here](https://www.maxmind.com/en/geolite2/signup)), you might prefer using [`node-geolite2`](https://github.com/runk/node-geolite2), which this repository is originally a fork of.\n\n## License\n\nThe databases themselves are provided by MaxMind under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)\n\nFor the library, see [LICENSE](https://github.com/GitSquared/node-geolite2-redist/blob/master/LICENSE).\n\n---\n\n**This software package includes GeoLite2 data created by MaxMind, available from [https://www.maxmind.com](https://www.maxmind.com).**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGitSquared%2Fnode-geolite2-redist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGitSquared%2Fnode-geolite2-redist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGitSquared%2Fnode-geolite2-redist/lists"}