Skip to content

giscafer/node-ipcity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🔨 get ip city info 获取ip归属城市信息

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published