node-ipcity

0.1.1 • Public • Published

node-ipcity

NPM version NPM download NPM license

get ip city info in Node.js,Base on http://int.dpool.sina.com.cn/iplookup/iplookup.php , http://www.ip.cn/

获取ip归属城市信息,获取ip地址

Install

npm install node-ipcity

Usage

    //获取指定ip的城市
    let ipcity=require('node-ipcity');
    ipcity.getIpCityInfo('221.193.207.29').then((city) => {
        console.log(city);//中国 河北 邯郸
    });
 
    //当前请求ip归属城市
    ipcity.getIpCityInfo().then((city) => {
        console.log('current city:',city); // 中国 广东 广州
    });
 
    //获取ip地址
    ipcity.getIp().then((ip) => {
        console.log('your ip is '+ip); //your ip is 183.220.19.214
    });
 

License


giscafer.com  ·  GitHub @giscafer  ·  Weibo @Nickbing Lao

Readme

Keywords

Package Sidebar

Install

npm i node-ipcity

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • giscafer