The official Node.js client library for the IPinfo.io IP data API. This library allows developers to retrieve comprehensive details for IP addresses, including geolocation (city, region, country, postal code, lat/long), ASN details, company data, and carrier information. The current stable version is 4.4.0. Releases are typically driven by API changes or significant internal improvements, as seen with the v4.0.0 update. Key differentiators include direct integration with the IPinfo.io platform, support for both Core and Lite APIs, and comprehensive data fields beyond basic geolocation. It works with ES5, ES6+, and TypeScript environments, and requires an API token for usage.
npm install node-ipinfoVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the IPinfo client with an API token from an environment variable and performs a lookup for a specific IP address, printing key details.
Review any custom network configurations or dependencies that might conflict with `node-fetch`. Ensure your Node.js environment is compatible with `node-fetch` (Node.js >=14 required).
Ensure your project's Node.js runtime is version 14 or higher. Update `engines.node` in your `package.json` if necessary and upgrade your Node.js installation.
Sign up for a free IPinfo account at `https://ipinfo.io/signup` and obtain your API token. Pass this token during `IPinfoWrapper` initialization.
Consult the IPinfo documentation for the Lite API vs. Core API data fields. If specific data is missing, you might need to switch to the `IPinfoWrapper` or check your API plan.
Verify your API token. Ensure it is correctly set as a string when initializing `IPinfoWrapper` or `IPinfoLiteWrapper`.
For ESM, use `import { IPinfoWrapper } from 'node-ipinfo';`. For CommonJS, use `const { IPinfoWrapper } = require('node-ipinfo');`.Switch to ES Module import syntax: `import { IPinfoWrapper } from 'node-ipinfo';`.