Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ip2countrify

ip2countrify is a memory-friendly and dependencies-free Node.js module for retrieving country information via https://ip2country.info JSON API. With support for IPv4 and IPv6 addresses.

Dependency Status Build Status Code Climate Known Vulnerabilities

Install

npm install ip2countrify

or

yarn add ip2countrify

Usage

var ip2countrify = require( 'ip2countrify' );

ip2countrify.lookup(
    '5.6.7.8',
    function( ip, results, error ) {
        if ( error ) {
            return console.warn( 'An error has occurred: ' + error );
        }

        console.log(
            'API results for ' + ip
        );
        console.log(
            'countryCode: ' + results.countryCode,
            'countryCode3: ' + results.countryCode3,
            'countryName: ' + results.countryName,
            'countryEmoji: ' + results.countryEmoji
        );
    }
);

Output

API results for 5.6.7.8
countryCode: DE
countryCode3: DEU
countryName: Germany
countryEmoji: 🇩🇪

Limitations

Free, but only for open source projects. Be fair!

Requirements

  • Internet connection

Notice

This product includes GeoLite data created by MaxMind, available from http://maxmind.com

About

A Node.js wrapper for IP2Country JSON API https://ip2country.info

Resources

License

Packages

No packages published