🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

openweathermap-fetcher

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openweathermap-fetcher

A Wrapper for openweathermap API for node application.

1.1.0
latest
Version published
Maintainers
0
Created

Openweathermap-fetcher

A fetcher for openweathermap api.Currently in initial stage.

Prerequisite

To use this package API key of openweathermap is needed. To get this you need to

  • Go to openweathermap website.
  • Create an free account.
  • Login wto your account and get the API Key.

currently tested on free account openweather API.

Installation

you can install this package using below npm command

npm install openweathermap-fetcher

or

yarn add openweathermap-fetcher

Usage


import { OpenWeatherMap } from 'openweathermap-fetcher';

const apiKey='your_api_key';

const openweathermap = new OpenWeatherMap({apiKey});

async function run() {
    try {
      const data = await openweathermap.fetchWeatherDataByCityName("Delhi");
      console.log("API Result:", data);
    } catch (error) {
      console.error("API Error:", error.message);
    }
  }
  
  run();

Method

  • fetchWeatherDataByCityName(cityName:string) The method will fetch the weather data by taking cityname as an argument and returns weather data.

  • fetchWeatherDataByCoordinates(latitude:string,longitude:string) This method will fetch the weather data by taking longitude and latitude as an argument and returns weather data.

  • fetchForecastDataByCityName(cityName:string) The method will fetch the forecast data by taking cityname as an argument and returns weather data.

  • fetchForecastDataByCoordinates(latitude:string,longitude:string) This method will fetch the forecast data by taking longitude and latitude as an argument and returns weather data.

Contribution

We welcome contributions! If you'd like to contribute to openweathermap-wrapper, please follow our Contribution Guidelines.

Author

Subramanya KS

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 18 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