Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including ipdata with all npm packages installed. Try it out:

var ipdata = require("ipdata")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

ipdata v1.1.2

JavaScript library that can be used in a Node.js application to gather information for an ip using https://ipdata.co.

IPData JavaScript Library

Build Status

JavaScript library that can be used in a web browser or Node.js application to gather information using https://ipdata.co.

Table of Contents

Install

$ npm install ipdata

Import the library

Import the library under a namespace.

import * as ipdata from 'ipdata';
// ipdata.lookup()

Import just the lookup function.

import { lookup } from 'ipdata';
// lookup()

Require the library.

var ipdata = require('ipdata');
// ipdata.lookup()

Use

The library by default will lookup the ip of the host computer.

lookup()
  .then(function(info) {
    // info.ip === '<hostcomputerip>'
    // ...
  })

Specify ip

You can provide an ip address to lookup.

lookup('8.8.8.8')
  .then(function(info) {
    // info.ip === 8.8.8.8
    // ...
  })

Specify api key

You can provide an api key.

lookup('8.8.8.8', 'apiKey')
  .then(function(info) {
    // info.ip === 8.8.8.8
    // ...
  })

Specify language

You can provide a language.

lookup('8.8.8.8', undefined, 'language')
  .then(function(info) {
    // info.ip === 8.8.8.8
    // ...
  })
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free