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

@apilayer/ipapi

v0.1.6

Published

Ipapi offers real-time Geolocation & reverse IP lookup.

Downloads

2

Readme

ipapi-go

Ipapi offers real-time Geolocation & reverse IP lookup.

Installation

Using npm

npm install --save @apilayer/ipapi

or yarn

yarn add @apilayer/ipapi

Getting Started

Head over to ipapi and create an account. Copy access key from dashboard.

import ipapi from '@apilayer/ipapi'

const useHTTPs = false
const layer = new ipapi("<your-access-key", useHTTPs, {
  language: "en",
  hostname: true, // includes hostname information in response
  security: true, // allows for return of security data
})

Checkout supported languages and their codes.

Note:

Each method below can accept options that overwrite the ones set above.

lookup

lookup returns information based on IP address

Signature:

lookup(ip: string, option: Options = null)

Example:

layer.lookup("134.201.250.155")

Response:

{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}

bulkLookup

bulkLookup return information of multiple IP addresses

Signature:

bulkLookup(ips: string[], option: Options = null)

Example:

layer.bulkLookup(["134.201.250.155"])

Response:

[{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}]

check

check autodetects the IP address and returns gathered information

Signature:

check(option: Options = null)

Example:

layer.check()

Response:

{
  ip: "134.201.250.155",
  hostname: "134.201.250.155",
  type: "ipv4",
  continent_code: "NA",
  continent_name: "North America",
  country_code: "US",
  country_name: "United States",
  region_code: "CA",
  region_name: "California",
  city: "Los Angeles",
  zip: "90013",
  latitude: 34.0453,
  longitude: -118.2413,
  location: {
    geoname_id: 5368361,
    capital: "Washington D.C.",
    languages: [
      {
        code: "en",
        name: "English",
        native: "English"
      }
    ],
    country_flag: "https://assets.ipstack.com/images/assets/flags_svg/us.svg",
    country_flag_emoji: "🇺🇸",
    country_flag_emoji_unicode: "U+1F1FA U+1F1F8",
    calling_code: "1",
    is_eu: false
  },
  time_zone: {
    id: "America/LosAngeles",
    current_time: "2018-03-29T07:35:08-07:00",
    gmt_offset: -25200,
    code: "PDT",
    is_daylight_saving: true
  },
  currency: {
    code: "USD",
    name: "US Dollar",
    plural: "US dollars",
    symbol: "$",
    symbol_native: "$"
  },
  connection: {
    asn: 25876,
    isp: "Los Angeles Department of Water & Power"
  },
  security: {
    is_proxy: false,
    proxy_type: null,
    is_crawler: false,
    crawler_name: null,
    crawler_type: null,
    is_tor: false,
    threat_level: "low",
    threat_types: null
  }
}

Supported Languages

| Code | Name | |:-------:|----------------------| | "en" | "English/US" | | "de" | "German" | | "es" | "Spanish" | | "fr" | "French" | | "ja" | "Japanese" | | "pt-br" | "Portugues (Brazil)" | | "ru" | "Russian" | | "zh" | "Chinese" |

License

MIT