项目作者: nasa8x

项目描述 :
Fetch the geo location of an IP address, IP6 and host name.
高级语言: JavaScript
项目地址: git://github.com/nasa8x/ip-to-location.git
创建时间: 2017-04-10T23:42:57Z
项目社区:https://github.com/nasa8x/ip-to-location

开源协议:MIT License

下载


Fetch the geo location of an IP address, IP6 and host name.

  1. npm install ip-to-location --save
  1. var ip2location = require('ip-to-location');
  2. ip2location.fetch('209.58.139.51', function(err, res){
  3. console.log(res);
  4. // {
  5. // ip: '209.58.139.51',
  6. // country_code: 'US',
  7. // country_name: 'United States',
  8. // region_code: 'CA',
  9. // region_name: 'California',
  10. // city: 'San Jose',
  11. // zip_code: '95131',
  12. // time_zone: 'America/Los_Angeles',
  13. // latitude: 37.3874,
  14. // longitude: -121.9024,
  15. // metro_code: 807
  16. // }
  17. })
  1. ip2location.fetch('209.58.139.51').then(res => {
  2. console.log(res);
  3. });