weather-data-collector
v1.0.0
Published
A package to collect weather data for a specific location using the weather-information-api.
Downloads
2
Readme
Weather Data Collector
A package to collect weather data for a specific location using the weather-information-api.
Installation
You can install the package via npm:
npm install weather-data-collector
Usage
First, import the WeatherCollector
class from the package:
const WeatherCollector = require('weather-data-collector');
Then, create an instance of WeatherCollector
with your OpenWeatherMap API key:
const apiKey = 'YOUR_API_KEY';
const collector = new WeatherCollector(apiKey);
You can fetch weather data for a location using the getWeatherForLocation
method:
const city = 'London';
try {
const weatherData = await collector.getWeatherForLocation(city);
console.log('Weather in London:', weatherData);
} catch (error) {
console.error(error.message);
}
Replace 'YOUR_API_KEY'
with your actual OpenWeatherMap API key.
License
This project is licensed under the MIT License - see the LICENSE file for details.