{"id":22485365,"url":"https://github.com/statsig-io/ip3country","last_synced_at":"2025-08-02T18:32:15.282Z","repository":{"id":42679141,"uuid":"364182644","full_name":"statsig-io/ip3country","owner":"statsig-io","description":"A JavaScript, zero-dependency, super small version of IP2Location LITE country lookups.","archived":false,"fork":false,"pushed_at":"2022-03-28T20:48:54.000Z","size":1494,"stargazers_count":40,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-09T04:39:55.981Z","etag":null,"topics":["geolocation","ip","javascript","nodejs","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/statsig-io.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":"CODEOWNERS","security":null,"support":null}},"created_at":"2021-05-04T08:02:04.000Z","updated_at":"2024-10-05T17:01:34.000Z","dependencies_parsed_at":"2022-09-15T19:10:19.910Z","dependency_job_id":null,"html_url":"https://github.com/statsig-io/ip3country","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statsig-io%2Fip3country","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statsig-io%2Fip3country/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statsig-io%2Fip3country/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statsig-io%2Fip3country/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statsig-io","download_url":"https://codeload.github.com/statsig-io/ip3country/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228499951,"owners_count":17929988,"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":["geolocation","ip","javascript","nodejs","typescript"],"created_at":"2024-12-06T17:12:28.225Z","updated_at":"2024-12-06T17:14:20.429Z","avatar_url":"https://github.com/statsig-io.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![npm version](https://badge.fury.io/js/ip3country.svg)](https://badge.fury.io/js/ip3country) [![install size](https://packagephobia.com/badge?p=ip3country)](https://packagephobia.com/result?p=ip3country) [![tests](https://github.com/statsig-io/ip3country/actions/workflows/tests.yml/badge.svg)](https://github.com/statsig-io/ip3country/actions/workflows/tests.yml)\n\n# ip3country\n\nThis is a zero-dependency, super small, IP address to 2-letter [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) lookup library. There are already several libraries available, but none met our requirements for binary size and speed.\n\nThis project in its entirety is \u003c300KB, compared to most alternatives out there that are north of 40MB (but might provide more than just countries).\n\n(Other languages: Python: https://github.com/statsig-io/ip3country-py, Go: https://github.com/statsig-io/ip3country-go, Ruby: https://github.com/statsig-io/ip3country-ruby, Kotlin: https://github.com/statsig-io/ip3country-kotlin, C#/.Net: https://github.com/statsig-io/ip3country-dotnet)\n\nThe database used in this project is compacted from [IP2Location](https://lite.ip2location.com/database/ip-country). Their DB1.LITE edition is provided under CCA, with the attribution below:\n\n---\n\n**NOTE**\n\nThis site or product includes IP2Location LITE data available from \u003ca href=\"https://lite.ip2location.com\"\u003ehttps://lite.ip2location.com\u003c/a\u003e.\n\n---\n\n## Usage\n\n```bash\n$ npm install ip3country\n```\n\n```js\n// Setup\nconst ip3country = require(\"ip3country\");\n\nip3country.init();\n\n// Lookup using ip4 str\nip3country.lookupStr(\"123.45.67.8\"); // 'KR'.\n\n// Lookup using numeric ip\nconsole.log(ip3country.lookupNumeric(2066563848));\n```\n\n## Accuracy\n\n`ip3country`'s accuracy is dependent on IP2Location LITE's accuracy. In our experience, for country lookups, it is accurate enough for most applications.\n\nIP2Location publishes accuracy reports here: https://www.ip2location.com/data-accuracy\n\nThere's also this third party report available: https://www.cl.cam.ac.uk/~nz247/publications/JSAC2011-Geolocation.pdf\n\n## Binary data\n\nTo make this library easy to consume, we're using [btoj](https://github.com/statsig-io/btoj) to transform the necessary binary data into a js module that can be imported like any other module. You won't need to list `ip3country` as an external in your build process.\n\nWe're currently using brotli compression via [NodeJS's `zlib` library](https://nodejs.org/api/zlib.html#zlib_zlib_brotlicompresssync_buffer_options), which won't work in Browser environments. If you want `ip3country` on a browser, check version `3.0.0` (and feel free to publish `ip3country-browser`).\n\n## Name\n\nAll variants of \"ip2country\" were already taken in npm, so we decided to step it up.\n\n## Motivation\n\nAt [Statsig](https://www.statsig.com), we needed a library to evaluate location-based conditions on Feature Gates (Feature Flags). We use ip3country to power country-level rollouts or A/B tests for new features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatsig-io%2Fip3country","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatsig-io%2Fip3country","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatsig-io%2Fip3country/lists"}