1.0.2 • Published 5 years ago

@yegor_heiz/ip-api v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

IP API Docs

Fast, accurate, reliable. Free for non-commercial use, no API key required. Serving more than 1 billion requests per day, trusted by thousands of businesses

Example

const IPApi = require('IPApi');

// Can be an IP address or a domain
const ip = '24.48.0.1';

const start = async () => {
    // Fetch 'country' and 'countryCode' fields from 24.48.0.1 on russian language
    return await IPApi.get(ip, ['country', 'countryCode'], 'ru');
    // Or you can do sth like this 
    // return await IPApi.get('google.com');
};

start()
    .then(result => {
        // Log result 
        console.log(result.data);
    })
    .catch(e => {
        console.log(e);
    });

IPApi

Wrapper for ip-api

Kind: global class

IPApi.get(ip, fields, lang) ⇒ Promise.<*>

Fetch data about ip address or domain

Kind: static method of IPApi

ParamTypeDefaultDescription
ipstringCan be ip address or domain
fieldsArray.<string>If you don't require all the returned fields you can specify which data should be returned
langstring"en"Localized city, regionName and country. Can be: en - English (default) de - Deutsch (German) es - Español (Spanish) pt-BR - Español - Argentina (Spanish) fr - Français (French) ja - 日本語 (Japanese) zh-CN - 中国 (Chinese) ru - Русский (Russian)

Example

get('google.com');
get('google.com', ['country', 'countryCode']);
get('google.com', ['country', 'countryCode'], 'de');