https://github.com/svtslv/geoip2-cli
Code and command-line utils for download and convert geoip2 maxmind mmdb
https://github.com/svtslv/geoip2-cli
cli command convert download geoip2 json maxmind
Last synced: about 1 year ago
JSON representation
Code and command-line utils for download and convert geoip2 maxmind mmdb
- Host: GitHub
- URL: https://github.com/svtslv/geoip2-cli
- Owner: svtslv
- Created: 2020-03-25T11:36:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T01:16:59.000Z (about 2 years ago)
- Last Synced: 2025-04-13T22:03:15.517Z (about 1 year ago)
- Topics: cli, command, convert, download, geoip2, json, maxmind
- Language: JavaScript
- Homepage:
- Size: 2.38 MB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GeoIP2 CLI
## Table of Contents
- [Description](#description)
- [Command line](#command-line)
- [User in code](#use-in-code)
- [License](#license)
## Description
Code and command-line utils for download and convert geoip2 maxmind mmdb
## Command line
#### Globally via `npm`
```sh
npm install --global geoip2-cli
```
#### Running on-demand:
```sh
npx geoip2-cli [options]
```
### Examples
```sh
npx geoip2-cli --help
```
```sh
'usage: geoip2-cli [options]',
'',
'options:',
' --download Download [false]',
' --downloadPath Path to download [./geoip2-cli]',
' --licenseKey Your license key [error]',
' --editions Editions: city, country, asn [city]',
' --date Database date version [empty]',
'',
' --convert Convert [false]',
' --mmdbPath Path to .mmdb [./geoip2-cli/GeoLite2-City.mmdb]',
' --jsonPath Path to .json [mmdbPath + .json]',
'',
' --help Print this list and exit',
' --version Print the version and exit.',
'',
'env:',
' GEOIP2_CLI_LICENCE_KEY',
```
## Use in code
### Installation
```bash
npm install geoip2-cli
```
### Examples
```ts
import { Geoip2CliDownloader } from 'geoip2-cli';
await Geoip2CliDownloader
.download({ licenseKey, date, edition, downloadPath })
.then(path => console.log(path));
```
```ts
import { Geoip2CliConverter } from 'geoip2-cli';
const converter = Geoip2CliConverter.openSync('GeoLite2-City.mmdb');
const result = converter.getUnique();
```
## License
MIT