Socket
Socket
Sign inDemoInstall

ip-locator-ex

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ip-locator-ex

###### Retrieve the information of an IP address or hostname.


Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Install size
12.2 kB
Created
Weekly downloads
 

Readme

Source

ip-locator

Retrieve the information of an IP address or hostname.

Uses ip-api.com to query for information.

Usage limits

ip-api.com will automatically ban any IP addresses doing over 150 requests per minute. To unban your IP click here.

You are free to use ip-api.com for non-commercial use. ip-api.com does not allow commercial use without prior approval.

For commercial, unlimited use see ip-api.com pro service.

Install

npm i --save ip-locator

Usage

var ipLocator = require('ip-locator')

ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString, function (err, data, quota) {
	console.log(data);
	console.log(quota);
});

ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString)
	.then(function(result) {
		console.log(result.data);
		console.log(result.quota);
	})
	.catch(function(error) {
		console.log(error);
	});

const result = await ipLocator.getDomainOrIPDetails(IpOrhostnameString, ResponseTypeString);

Quota

{
	secondsToReset, // how many secons until remaining requests count will be reset
	requestsRemaining // how many requests can be sent
};

Response Types

  1. json
  2. xml
  3. csv
  4. line

Example

var ipLocator = require('ip-locator')

ipLocator.getDomainOrIPDetails('google.com','json', function (err, data) {
  console.log(data)
});

Outputs:

{ as: 'AS15169 Google Inc.',
  city: 'Mountain View',
  country: 'United States',
  countryCode: 'US',
  isp: 'Google',
  lat: 37.4192,
  lon: -122.0574,
  org: 'Google',
  query: '74.125.130.101',
  region: 'CA',
  regionName: 'California',
  status: 'success',
  timezone: 'America/Los_Angeles',
  zip: '94043' }

Collaborators

Shahid Iqbal

Keywords

FAQs

Last updated on 24 Apr 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc