🌐 An http://ipinfo.io NodeJS wrapper.
JavaScript
Latest commit a51eb09 Jan 18, 2017 @IonicaBizau Remove test output
Permalink
Failed to load latest commit information.
.blah Add the gitignore template Jan 18, 2017
example Improve examples May 31, 2016
lib Make tests and module run on node 4.x. Jan 16, 2017
.gitignore Ignore .nyc_output Jan 18, 2017
CONTRIBUTING.md Updated docs Apr 26, 2016
DOCUMENTATION.md Updated docs May 31, 2016
LICENSE Updated docs Jan 18, 2017
README.md Updated docs Jan 18, 2017
package.json ⬆️ 1.3.5 🎉 Jan 18, 2017
test.js Add tests. Jan 16, 2017

README.md

ipinfo

Patreon PayPal AMA Version Downloads Get help on Codementor

An http://ipinfo.io NodeJS wrapper.

☁️ Installation

$ npm i --save ipinfo

📋 Example

const ipInfo = require("ipinfo");

// Current ip information
ipInfo((err, cLoc) => {
    console.log(err || cLoc);
    // { ip: '94. ... .77',
    //   hostname: '... .com',
    //   city: '...',
    //   region: 'England',
    //   country: 'GB',
    //   loc: '5...,3...',
    //   org: '... UK Limited',
    //   postal: '...' }

    // Get information about a known ip
    ipInfo("8.8.8.8", (err, cLoc) => {
        console.log(err || cLoc);
        // { ip: '8.8.8.8',
        //   hostname: 'google-public-dns-a.google.com',
        //   city: 'Mountain View',
        //   region: 'California',
        //   country: 'US',
        //   loc: '37.3845,-122.0881',
        //   org: 'AS15169 Google Inc.',
        //   postal: '94040' }

        // Get organization
        ipInfo("8.8.8.8/org", (err, cLoc) => {
            console.log(err || cLoc);
            // AS15169 Google Inc.
        });
    });
});

📝 Documentation

ipInfo(type, token, callback)

Makes requests to the ipinfo.io resources.

Params

  • String type: An optional string parameter that can be:
    • An ip (e.g. "8.8.8.8")
    • An ip and the a field (e.g. "8.8.8.8/org")
  • String token: The token used if you have to make an authorized request.
  • Function callback: The callback function.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

💰 Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. 🚀

PayPal donations are appreciated too! Each dollar helps.

Thanks! ❤️

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list.

  • cli-sunset—A fancy command line tool for knowing the sunset time.
  • hapi-geo-locate (by Future Studio)—Provide IP geo location for incoming requests in hapi
  • ipinfo-cli (by Chintan Radia)—Get current ip information
  • sphere-ipinfo-mashup (by Martin Möllmann)—Create carts in SPHERE.IO with information based on your IP address.
  • sunset-year—Sunset times during the year, every week.

📜 License

MIT © Ionică Bizău