npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apiip.net

v1.3.0

Published

This package allows you to get geolocation data about IP address.

Downloads

346

Readme

IP to Location (Node.js and browser)

apiip.net provides 1.000 free requests per month. For higher plans, check out the website

Installation

You need to get your API key from here: https://apiip.net/get-started and you'll get 1.000 free requests/month

Install the package with:

npm install apiip.net
# or
yarn add apiip.net

Usage

The package needs to be configured with your account's API key, which is available in the Apiip.net Dashboard

const apiip = require('apiip.net')('YOUR_API_KEY');

apiip
  .getLocation()
  .then((results) => console.log(results))
  .catch((error) => console.error(error));

Or using ES6 modules and async/await:

import Apiip from 'apiip.net';
const apiip = Apiip('YOUR_API_KEY');

(async () => {
  console.log(await apiip.getLocation());
})();

HTTPS Encryption

By default, the SSL/TLS is turned on, if you want to disabled it just pass the options parameter

Example

const apiip = require('apiip.net')('YOUR_API_KEY', { ssl: false });

Or using ES6 module import

import Apiip from 'apiip.net';
const apiip = Apiip('YOUR_API_KEY', { ssl: false });

Configuration

Call getLocation method with config object

const apiip = require('apiip.net')('YOUR_API_KEY');

apiip
  .getLocation({
    ip: '67.250.186.196', // '67.250.186.196, 188.79.34.191, 60.138.7.24' - for bulk request
    output: 'xml',
    fields: 'city, countryName, currency.name',
    languages: 'es',
  })
  .then((results) => console.log(results))
  .catch((error) => console.error(error));

| Option | Type | Description | Default | | ----------- | -------- | ---------------------------------------------------------------------------------------------------------- | ------------ | | ip | string | Optional. Get location about the specify IP or multiple IPs. | Requester IP | | output | string | Optional. Specify response format, XML or JSON. | JSON | | fields | string | Optional. Specify response fields. | All fields | | languages | string | Optional. Specify response language. | EN | | callback | string | Optional. The callback function name (JSONP Callbacks) | - |

Example complete response

{
  "ip": "67.250.186.196",
  "continentCode": "NA",
  "continentName": "North America",
  "countryCode": "US",
  "countryName": "United States",
  "countryNameNative": "United States",
  "regionCode":"NY"
  "regionName":"New York"
  "cityGeoNameId":5128581,
  "city": "New York",
  "postalCode": "10001",
  "latitude": 40.8271,
  "longitude": -73.9359,
  "capital": "Washington D.C.",
  "phoneCode": "1",
  "countryFlagEmoj": "🇺🇸",
  "countryFlagEmojUnicode": "U+1F1FA U+1F1F8",
  "isEu": false,
  "borders": [
    "CAN",
    "MEX"
  ],
  "topLevelDomains": [
    ".us"
  ],
  "languages": {
    "en": {
      "code": "en",
      "name": "English",
      "native": "English"
    }
  },
  "currency": {
    "code": "USD",
    "name": "US Dollar",
    "symbol": "$",
    "number": "840",
    "rates": {
      "EURUSD": 0.99518
    }
  },
  "timeZone": {
    "id": "America/New_York",
    "currentTime": "10/26/2021, 2:54:10 PM",
    "code": "EDT",
    "timeZoneName": "EDT",
    "utcOffset": -14400
  },
   "userAgent": {
    "isMobile": false,
    "isiPod": false,
    "isTablet": false,
    "isDesktop": true,
    "isSmartTV": false,
    "isRaspberry": false,
    "isBot": false,
    "browser": "Chrome",
    "browserVersion": "100.0.4896.127",
    "operatingSystem": "Windows 10.0",
    "platform": "Microsoft Windows",
    "source": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
  },
  "connection": {
    "asn": 12271,
    "isp": "Charter Communications Inc"
  },
  "security": {
    "isProxy": false,
    "isBogon": false,
    "isTorExitNode": false,
    "isCloud": false,
    "isHosting": false,
    "isSpamhaus": false,
    "suggestion": "allow",
    "network": "67.250.176.0/20"
  }
}

More Information