longitude-client

0.1.2 • Public • Published

longitude-client

Geolocation for browsers

CDN

<script src="https://unpkg.com/longitude-client" charset="utf-8"></script>

Install

$ npm install --save longitude-client

Usage

With any IP

const longitude = require('longitude-client');

longitude('8.8.8.8').then(data => {
  console.log(data);
  // => {
  // =>   ip: '8.8.8.8',
  // =>   country_code: 'US',
  // =>   country_name: 'United States',
  // =>   latitude: 37.751,
  // =>   longitude: -97.822,
  // =>   ...
  // => }
});

With device IP

const longitude = require('longitude-client');

longitude().then(data => {
  console.log(data);
  // => {
  // =>   ip: Your IP,
  // =>   ...
  // => }
});

API

longitude(ip)

Returns a promise with the geoip data

ip

Type: string

The IP - Address you want to check

Related

License

MIT © Tobias Herber

Readme

Keywords

none

Package Sidebar

Install

npm i longitude-client

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • tobihrbr