Socket
Book a DemoInstallSign in
Socket

@toil/ip-geolocation

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toil/ip-geolocation

A library for free (and not only free) use of the ip geolocation APIs

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
21
133.33%
Maintainers
0
Weekly downloads
 
Created
Source

IP Geolocation

GitHub Actions npm ru en

A library for free (and not only free) use of the IP Geolocation APIs, which supports working with JavaScript, TypeScript, and also has built-in separated types for Typebox.

Installation

Installation via Bun:

bun add @toil/ip-geolocation

Installation via NPM:

npm install @toil/ip-geolocation

Getting started

To get started with the API, you need to create an IPGeolocation client. This can be done using the code below.

const client = new IPGeolocationClient({
  service: IPGeolocationService.freeipapi,
});

const result = await client.lookup("103.21.244.0");

You can see more code examples here

Available services

In some services, transferring reserved ranges of IP addresses may cause an error - this is normal.

If you are missing some data in the lookup method, and the service should have it, it's recommended to consider using the provider directly using the rawLookup method

StatusServiceLimitsFeatures
FreeIPAPI60 req/mindetail
IPAPICom45 req/mindetail

More detailed information about the supported access services here

Build

To build, you must have:

  • Bun

Don't forget to install the dependencies:

bun install

Regular Build

Building the entire package:

bun build:bun

Building a types for TypeBox

You can use this build option if you only want to build types for TypeBox:

bun build:typebox

Tests

The library has minimal test coverage to check it's performance.

Run the tests:

bun test

Keywords

geolocation

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.