TypeScript Library
The ipflare npm package offers a simple and efficient way to retrieve geolocation information for IP addresses using the IP Flare API.
Notice!
X-API-Key
header of your requests.Installation
Usage
After installing the package, you can use it in your JavaScript or TypeScript projects to fetch geolocation data.
Initialize the Client
Examples
Once the client is initialized, you can use it to fetch geolocation data within your application. Below are some examples of how to use the client to retrieve geolocation information.
Single IP Lookup
The following example demonstrates how to use the client to fetch geolocation data for a single IP address.
Lookup with Additional Fields
To retrieve additional fields, pass an array of desired fields. Visit the Geolocation page for more information.
Bulk IP Lookup
The following example demonstrates how to use the client to fetch geolocation data for multiple IP addresses. Note the results may not correspond in order to the input list.
TypeScript Types
The ipflare library provides the following types to ensure correct data handling: