user-location-finder
v1.0.3
Published
The user location finder package provides a simple and efficient way to retrieve the user's current location, including the country and town/city, directly from their browser. It utilizes the browser's built-in Geolocation API combined with the BigDataClo
Downloads
62
Maintainers
Readme
user-location-finder
Install
yarn add user-location-finder
or
npm i user-location-finder
Sneakpeek
Demo
Usage
import getUserLocation from 'user-location-finder';
getUserLocation()
.then(location => {
console.log(`Country: ${location.country}, Town: ${location.town}`);
})
.catch(error => {
console.error('Error fetching location:', error);
});
About
The user location finder package provides a simple and efficient way to retrieve the user's current location, including the country and town/city, directly from their browser. It utilizes the browser's built-in Geolocation API combined with the BigDataCloud reverse geocoding service to convert geographical coordinates (latitude and longitude) into readable location information.
Features
- Easy to Use - Simple API that allows you to get the user's country and town with a single function call.
- No API Key Required - Uses BigDataCloud's free reverse geocoding service, so no API key is needed for basic usage.
- Real-Time Location - Retrieves the user's location in real-time using the browser's Geolocation API.
- Lightweight - Minimal dependencies, ensuring fast performance and easy integration into any JavaScript or Node.js project.
Dependencies
axios for making HTTP requests to the BigDataCloud API.
License
MIT