0.1.1 • Published 8 years ago

node-ipcity v0.1.1

Weekly downloads
73
License
MIT
Repository
github
Last release
8 years ago

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

npm.io


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